日期:2014-05-17 浏览次数:20944 次
string sql = "select [type],[name],[price],[cost],[sellDate],[vipID],[staff] from SellLog";
dgvSellInfo.DataSource = DBHelper.SelectData(sql);
public static DataSet SelectData(string sql)
{
DataSet ds = new DataSet();
try
{
OleDbConnection con = new OleDbConnection("Provider=Microsoft.ace.oledb.12.0;Data Source=ShopData.dll");
OleDbDataAdapter MyAdapter = new OleDbDataAdapter(sql, con);
MyAdapter.Fill(ds);
}
catch (Exception e)
{
System.Windows.Forms.MessageBox.Show("查询失败!\n\n数据库异常:" + e.Message);
}
return ds;
}