急!急!急!VB编程调用数据表 查询数据表中姓名=赵刚人的信息
来源:百度知道 编辑:UC知道 时间:2024/05/26 05:38:33
Adodc1.RecordSource = "select * from 表 where 姓名 like '" & Text1.Text & "' and 专业 like '" & Text2.Text & "'"
怎样在这段代码上修改
怎样在这段代码上修改
Adodc1.RecordSource = "select * from 表 where 姓名 = '赵刚'
如果是模糊查询 就用下面的
Adodc1.RecordSource = "select * from 表 where 姓名 like '%赵刚%'
如果赵刚是取控件得值 就用
Adodc1.RecordSource = "select * from 表 where 姓名 = '" & Text1.Text & "'
或者
Adodc1.RecordSource = "select * from 表 where 姓名 like '%" & Text1.Text & "%'
用等号而不要用like哈
Adodc1.RecordSource = "select * from 表 where 姓名 = '赵刚' and 专业 = '" & trim(Text2.Text) & "'"
用下面的代码
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select * from ut where uname like '%赵刚%'"
Adodc1.Refresh
之中,ut用你的表的名字代替,uname用表中姓名的列名代替。