在 C# Windows 窗体应用程序中搜索 Microsoft Access 记录?
如何在 C# Windows 窗体应用程序中搜索 Microsoft Access 记录?
代码:
private void btnsearch_Click(object sender, EventArgs e)
{
dataAdapter = new OleDbDataAdapter("SELECT * from tblStudents WHERE studid='" +
txtstudid.Text + "' ",
conn);
dataset = new DataSet();
dataAdapter.Fill(dataset);
dataGridView1.DataSource = dataset.Tables[0];
}
How to search for a Microsoft Access record in a C# Windows Forms application?
Code:
private void btnsearch_Click(object sender, EventArgs e)
{
dataAdapter = new OleDbDataAdapter("SELECT * from tblStudents WHERE studid='" +
txtstudid.Text + "' ",
conn);
dataset = new DataSet();
dataAdapter.Fill(dataset);
dataGridView1.DataSource = dataset.Tables[0];
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要将更改返回到数据库中,您所需要做的就是使用
DataTable
作为参数调用OleDbDataAdapter
的Update()
来实现这一目标。To get the changes back into the database, all you have to do is call the
Update()
of theOleDbDataAdapter
with theDataTable
as the argument to accomplish this.