tdsflightinfo.cs
来自「航空公司用的简单管理系统」· CS 代码 · 共 66 行
CS
66 行
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Data.Common;
using System.ComponentModel;
using System;
namespace SouthernAir.Business.TypeDataSet {
[DataObject]
partial class tdsFlightInfo
{
[DataObjectMethod(DataObjectMethodType.Select, true)]
public static BSAFlightDataTable GetResult(string strObjectAddress, string strYear, string strMonth, string strDay,
string strPrice)
{
try
{
string strDate = strYear + "-" + strMonth + "-" + strDay;
string strConn = "Data Source=TRTGR\\SQLEXPRESS;AttachDbFilename=D:\\Project\\SouthernAir\\SouthernAir.Business\\SouthernAirData.mdf;Integrated Security=True";
string strSQL = "";
if (strPrice == "无要求")
{
strSQL = "Select * From BSAFlight Where ObjectAddress = '" + strObjectAddress + "' and FlightDate = '" + strDate + "'";
}
else if (strPrice == "800以内")
{
strSQL = "Select * From BSAFlight Where ObjectAddress = '" + strObjectAddress + "' and FlightDate = '" + strDate + "' and CPrice <= 800";
}
else if (strPrice == "1000以内")
{
strSQL = "Select * From BSAFlight Where ObjectAddress = '" + strObjectAddress + "' and FlightDate = '" + strDate + "' and CPrice <= 1000";
}
else if (strPrice == "1200以内")
{
strSQL = "Select * From BSAFlight Where ObjectAddress = '" + strObjectAddress + "' and FlightDate = '" + strDate + "' and CPrice <= 1200";
}
else if (strPrice == "1500以内")
{
strSQL = "Select * From BSAFlight Where ObjectAddress = '" + strObjectAddress + "' and FlightDate = '" + strDate + "' and CPrice <= 1500";
}
else
{
strSQL = "Select * From BSAFlight";
}
using (SqlConnection conn = new SqlConnection(strConn))
{
conn.Open();
SqlDataAdapter da = new SqlDataAdapter(strSQL, conn);
DataSet ds = new DataSet();
da.Fill(ds, "Result");
BSAFlightDataTable oDataTable = new BSAFlightDataTable();
oDataTable.Merge(ds.Tables["Result"]);
return oDataTable;
}
}
catch
{
BSAFlightDataTable oDataTable = new BSAFlightDataTable();
return oDataTable;
}
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?