呵呵,用adodc不是更好吗?datagrid也是来源于adodc呀!
label1.caption=adodc1.recordset(0)
adodc1.recordset.movenext
label2.caption=adodc1.recordset(0)
adodc1.recordset.movenext
label3.caption=adodc1.recordset(0)
你是不是这个意思呀?
我比较笨,我理解你是这个目的,方法笨了些。
label1.caption=adodc1.recordset(0)
adodc1.recordset.movenext
label2.caption=adodc1.recordset(0)
adodc1.recordset.movenext
label3.caption=adodc1.recordset(0)
你是不是这个意思呀?
我比较笨,我理解你是这个目的,方法笨了些。
haor(一个好人)你好!久闻,我的问题是这样,在DataGrid中有两列,一列为学
号、另一列为姓名,如:
学号 姓名
121 王
122 李
123 白
................................
想用三个Label(Label1、Label2、Label3)同时将姓名显示出来,Label1显示"王"、
Label2显示"李"、Label3显示"白"。
flyinthesky(不哭不笑)你好!
我的问题是这样,在DataGrid中有两列,一列为学号、另一列为姓名,如:
学号 姓名
121 王
122 李
123 白
................................
想用三个Label(Label1、Label2、Label3)同时将姓名显示出来,Label1显示"王"、
Label2显示"李"、Label3显示"白"。按你所说试了,但Label1、Label2、Label3
同时显示的都是"王"字。(给2分)
另外有个问题,如何才能将分给你,是直接写在这上面吗?请愿谅,我是一个新手。
以前在书上看到的,具体方法有些记不清了,试一试吧。
for i=1 to 3
lael1.caption=adodc1.recordset(0)
adodc1.movenext
if adodc1.eof then
label2.caption=""
label3.caption=""
exit for
end if
'--------------------
lael2.caption=adodc1.recordset(0)
adodc1.movenext
if adodc1.eof then
label3.caption=""
exit for
end if
'--------------------
lael3.caption=adodc1.recordset(0)
adodc1.movenext
if adodc1.eof then
exit for
end if
next
据库成员。
Private Sub Command1_Click()
Text1.Text = ""
End SubPrivate Sub Command2_Click()
End
End SubPrivate Sub Command3_Click()
On Error GoTo ErrMsg
Adodc1.Recordset.Update
Exit Sub
ErrMsg:
MsgBox Err.Description, vbExclamation, " 花名册- Update"
End SubPrivate Sub Text1_Change()
SQL = "Select * From 花名册 Where 学号 Like '" & Text1.Text & "%'"
Adodc1.RecordSource = SQL
Adodc1.Refresh
End Sub