在button那里输入以下代码
string connectionString = "Provider=Microsoft.Jet.OleDb.4.0;Data source=dan.mdb";
OleDbConnection conn = new OleDbConnection(connectionString);
string strSQL = " select * from dan where 运单号=" + textBox1.Text + "";
OleDbDataAdapter da = new OleDbDataAdapter(strSQL, conn);
DataSet ds = new DataSet();
da.Fill(ds, "dan");
dataGridView1.DataSource = ds.Tables[0].DefaultView;调试查询的时候,出错提示说“至少一个参数没有被指定值。”是什么问题呢? 还有麻烦帮忙写一下如果查询不到结果的提示消息,谢谢
string connectionString = "Provider=Microsoft.Jet.OleDb.4.0;Data source=dan.mdb";
OleDbConnection conn = new OleDbConnection(connectionString);
string strSQL = " select * from dan where 运单号=" + textBox1.Text + "";
OleDbDataAdapter da = new OleDbDataAdapter(strSQL, conn);
DataSet ds = new DataSet();
da.Fill(ds, "dan");
dataGridView1.DataSource = ds.Tables[0].DefaultView;调试查询的时候,出错提示说“至少一个参数没有被指定值。”是什么问题呢? 还有麻烦帮忙写一下如果查询不到结果的提示消息,谢谢
code=C#]
string strSQL = " select * from dan where 运单号=’" + textBox1.Text + "‘";
[/code]
string strSQL="select *from dan where 运单号='"+textBox2.Text.Trim()+"'";
第二:同5楼说的一样 写道business层 和database层 头 button 事件代码头只是调用 这样代码清晰 易于维护