📄 tdsflightinfo.cs
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -