如何使用 C# 将表值与文本框值匹配
这是选择用户密码的代码,其中 id = 1 ; 我想将此值与文本框匹配。 如果该值匹配,则将打开第二个窗口窗体。 但它不起作用......
OleDbConnection con = new OleDbConnection(database2.conn);
con.Open();
OleDbCommand OCom = new OleDbCommand("select user_pasword from tblpasword where id = 1", con);
OleDbDataReader Dreader = OCom.ExecuteReader();
while (Dreader.Read())
{
MessageBox.Show(Dreader + "");
}
This is code for select user password where id = 1 ; I want to match this value to a text box. If the value is a match then second window form will be open. But it is not working ...
OleDbConnection con = new OleDbConnection(database2.conn);
con.Open();
OleDbCommand OCom = new OleDbCommand("select user_pasword from tblpasword where id = 1", con);
OleDbDataReader Dreader = OCom.ExecuteReader();
while (Dreader.Read())
{
MessageBox.Show(Dreader + "");
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果我没记错的话我想你可以使用
If I am not wrong I think you can use
将您的对象包装在 using 语句中......这样它们就会在完成后关闭并处置。 返回您正在查找的字符串...如果 GetPassword() == null,则未找到,否则返回字符串。
Wrap your objects in using statements....so they will close and dispose when done. Return the string you are looking for... if GetPassword() == null, not found otherwise its the string returned.