在数据访问层
public class TradeService
{
static StringBuilder sb = new StringBuilder();
//连接数据库获取用户订票数据
public static DataSet GetTrade()
{
DataSet ds = null;
try
{
SqlConnection conn = new SqlConnection(DBHelper.connString);
string sql = "………查询语句省略………";
SqlDataAdapter ad = new SqlDataAdapter(sql, conn);
ds = new DataSet();
if (ds.Tables["tradeList.seatNO"] != null)
{
ds.Tables["tradeList"].Clear();
}
ad.Fill(ds, "tradeList");
}
catch (Exception ex)
{
throw ex;
}
return ds;
}
}