vb6.0 与 SQL2000

sn216 2003-08-21 11:18:40
1.查询
GetFirstName()和GetLastName()是解析姓名的函数
Dim SearchStr As String
Dim FirstN As String
Dim LastN As String
SearchStr = InputBox("输入完整姓名", "资料查询")
FirstN = GetFirstName(SearchStr)
LastN = GetLastName(SearchStr)
Text2.Text = LastN & FirstN
Adodc1.RecordSource = "select * from employees where FirstName=FirstN and LastName=LastN"
Adodc1.Refresh

报错:列名‘FirstN’无效!

请问:如何才能查询完成?
2.添加
On Error GoTo AddErr
Adodc1.Recordset.MoveLast
DataGrid1.SetFocus
SendKeys "{down}"

????????????此处好像缺什么?如何加?SendKeys "{down}"

Exit Sub
AddErr:
MsgBox Err.Description
...全文
5 点赞 收藏 4
写回复
4 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
DragonBill 2003-08-22
Adodc1.RecordSource = "select * from employees where FirstName=FirstN and LastName=LastN"

改为 Adodc1.RecordSource = "select * from employees where FirstName='" & FirstN & "' and LastName=LastN"

SendKeys "{down}" 后面加 DoEvents
回复
猞猁狲 2003-08-22
Adodc1.RecordSource这对吗?因该用adodc1.recordset吧!!
回复
planetike 2003-08-22
Adodc1.RecordSource = "select * from employees where FirstName='" & FirstN & "' and LastName='"& LastN & "'"
回复
sn216 2003-08-22
不行呀,各位高手能先验一下,在发,
SendKeys "{down}" 后面加 DoEvents没有效果
回复
发帖
VB基础类
创建于2007-09-28

7476

社区成员

VB 基础类
申请成为版主
帖子事件
创建了帖子
2003-08-21 11:18
社区公告
暂无公告