在数据库中查找记录 [英] find records in database

查看:87
本文介绍了在数据库中查找记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在vb.net的数据库中查找记录?
我尝试使用此代码

how find records in database in vb.net?
i try in this code

ds.clear
da=new sqldataadapter("SELECT * FROM members WHERE name=" & textbox1.text &"", dbconn)
try
   da.fill(ds,members)
   bind()
catch ex as exception
   mesaagebox.show(ex.message)
   exit sub
end try

sub bind()
   lable1.databindings.add("text",ds,"members.name")
end sub

然后我得到了.像这样的错误的列名"错误信息
但列在数据库中.
请更正此代码.请
谢谢
然后,我尝试通过那里的电话号码进行搜索.它的工作.
当我为搜索框输入字符串值时显示错误的时间错误消息

then i got. erro msg like that ''invalied column name''
but column is in database.
please correct this code.please
thank
then i try search by there telephone no. its work.
when i enter string value for search box display erlier time erro message

推荐答案

阿马尔,

根据我的理解,当您将数据集绑定到标签时,列名称"memname"在数据集"members"中不存在.如果我遗漏了任何内容,请更正我.

建议:使用where条件时,如果不考虑区分大小写的比较,则将textbox.text值分配给变量,并进行比较,例如upper(columnname)= upper(txtboxvalue).
Hi Amal,

As per my understanding,when you are binding the dataset to the label, the column name "memname" is not present in the dataset "members".Correct me if iam missing anything.

Suggestion: When you are using a where condition, assign the textbox.text value to a variable and compare like upper(columnname)=upper(txtboxvalue) , if you are not looking at case sensitive comparision.


这篇关于在数据库中查找记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆