vb MSHFlexGrid 连接数据库问题
我通过下程序可以成功显示记录Private Sub Command1_Click()
Dim MyCnn As New ADODB.Connection
Dim MyRs As New ADODB.Recordset
MyCnn.Open "Driver={MySQL ODBC 3.51 Driver};Server=117.41.***.**;Database=sqlfanchunmy;User=fanchun; Password=fan1238765chun;Option=3;"
MyRs.Open "select * from biao where name = 'fanqi '", MyCnn, adOpenKeyset, adLockOptimistic
Set MSHFlexGrid1.DataSource = MyRs
MSHFlexGrid1.ColWidth(0) = 300
End Sub
但是程序使用了文本框作为条件就无法显示记录。请问是什么问题
Private Sub Command1_Click()
Dim MyCnn As New ADODB.Connection
Dim MyRs As New ADODB.Recordset
Dim temp As String
temp = Text1.Text
MyCnn.Open "Driver={MySQL ODBC 3.51 Driver};Server=117.41.***.**;Database=sqlfanchunmy;User=fanchun; Password=fan1238765chun;Option=3;"
MyRs.Open "select * from biao where name = 'temp '", MyCnn, adOpenKeyset, adLockOptimistic
Set MSHFlexGrid1.DataSource = MyRs
MSHFlexGrid1.ColWidth(0) = 300
End Sub
文本框内容就是fanqi
初上本站,新手,不懂规矩,请包涵
是不是数据库中设计表时有什么问题没有注意?
[ 本帖最后由 mengyanshg 于 2015-6-21 10:27 编辑 ]