我想用VB获取数据库中的一段数据,并返回数据的同一列的值 不知道那些错,去大神帮助
Public Sub Button1_Click()Dim usr As New SunUser
usr.BindCurrentUser
Dim ds As New SunDataset
Dim sql As String
Dim usrid As String
Dim var As Variant
Dim db As SunDatasource
db.Open "HYBQ" , dbReadWrite
usrid = usr.Name
sql = "select NAME from test where user_id = " + usrid
ds.CreateDataset sql , var
MsgBox ds.CellData(1,2)
db.Close
ComboBox1.Text = sql
End Sub