在数据库表上查找数据 [英] find data on database table

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

问题描述

嘿朋友.我有一些项目.我需要获取地址到
当我在textbox中输入名称时,标签会变成这样.

hey friend. i have some project. i need get address to
lable when i enter name into textbox.my code is like this

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


不幸的是,它不起作用,我收到了此错误消息
无效的列名称"
然后,我尝试按年龄搜索信息.它的工作.但是
输入名称时,我不知道要获取地址.
即时通讯使用vb.net和sql server.
请帮我 .请


unfortunatly its not work and i got this erro message
"invalied column name"
then i try search infomation by there age. its worked. but
i have no idea to get address when enter there names.
im using vb.net and sql server.
please help me . please

推荐答案

永远不要这样做.我会解雇写这样的代码或问这类问题的任何人.

您的代码对我来说删除数据库很简单.您永远不应该通过连接字符串来构建SQL.

您的变量具有诸如textbox1之类的名称,这些名称很容易造成混淆,并且无法自行记录.

您的错误意味着它说的是什么,您正在尝试读取不存在的列.

您不必一遍又一遍地问同样的问题.您需要放弃当前的项目,购买一本初学者的书,然后逐步进行学习.
You should never do this. I''d fire anyone who wrote code like this, or asked this sort of question.

Your code makes it trivial for me to delete your database. You should never build SQL from concatenating strings.

Your variables have names like textbox1 which make it easy to get confused and are not self documenting.

Your error means what it says, you''re trying to read a column that is not there.

You need to not ask the same question over and over. You need to abandon your current project, buy a beginners book and work through it.


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

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