Dim Cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
'﹚竡ADODB
Dim strCn As String
Dim db_host As String
Dim db_user As String
Dim db_pass As String
Dim db_data As String
Dim i As Integer
' ﹚竡 SQL 粂
Dim sql As String
'计沮畐IP
db_host = "、、"
'姐腹
db_user = "、、"
'姐腹盞絏
db_pass = "、、"
'rs clode
'硈钡计沮畐
db_data = "Product"
strCn = "DRIVER={MySQL ODBC 5.3 ANSI Driver};" & _
"SERVER=" & db_host & ";" & _
"DATABASE=" & db_data & ";" & _
"UID=" & db_user & ";PWD=" & db_pass & ";" & _
"OPTION=3;stmt=SET NAMES UF8"
' 连接数据库
Cn.Open strCn
' 设置该属性, 使 recordcount 和 absolutepage 属性可用
Cn.CursorLocation = adUseClient
'' 访问表 zhanbie
sql = "select * from chanliang where gonghao='" & gonghao2.Text & "'
rs.Open sql, Cn
DataGridView1.DataSource=rs‘ 查詢到的資料顯示到控件DataGridView1中,也沒報錯,控件顯示空白
求大神幫幫~ 謝謝~