-2
private Command1_Click()
Dim a as string
a = text1.text
OpenQuery "SELECT * FROM a WHERE Chair;"
txtChair.Text = myRs.Fields(0).Value
myRs.MoveNext
loop
end sub
private Command1_Click()
Dim a as string
a = text1.text
OpenQuery "SELECT * FROM a WHERE Chair;"
txtChair.Text = myRs.Fields(0).Value
myRs.MoveNext
loop
end sub
您的代碼示例缺少開放Do
語句,可能是超出站點。另外,@nabuchodonossor是正確的,至多循環結束時,最後一條記錄的字段(0)的值將位於txtChair.Text中。但是你要求幫助的是建立一個單一的字符串查詢,在這裏你用一個變量值代替部分字符串。
Private Command1_Click()
Dim a as string
a = text1.text
'this query isn't right, but not sure what to do with it
'this is something like normally "WHERE Field = 'Chair'"
OpenQuery "SELECT * FROM " & a & " WHERE Chair;" 'The & concatenates the separate strings
Do While rs.EOF = False
txtChair.Text = myRs.Fields(0).Value
myRs.MoveNext
Loop
End Sub
請再想一想:這怎麼可能把一個未知的行數(因爲在你選擇一個未知的數列的*的),在一個單一的文本框中。看看datagrid或類似的組件。 flexgrid是vb6的一部分(儘管它必須單獨安裝,據我所知) – nabuchodonossor