vb连接数据库在datagrid中显示的问题
我想连接sql数据库并在datagrid中显示,代码如下:PrivateSubCommand1_Click()DimconnAsADODB.ConnectionDimrs...
我想连接sql数据库并在datagrid中显示,代码如下:
Private Sub Command1_Click()
Dim conn As ADODB.Connection
Dim rst As ADODB.Recordset
Set conn = New ADODB.Connection
Set rst = New ADODB.Recordset
conn.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=jilu;Data Source=."
rst.Open "select * from cqwz ", conn
DataGrid1.DataSource = rst
End Sub
执行到这里 DataGrid1.DataSource = rst
总提示“编辑错误,未找到方法或数据成员”
高手赐教! 展开
Private Sub Command1_Click()
Dim conn As ADODB.Connection
Dim rst As ADODB.Recordset
Set conn = New ADODB.Connection
Set rst = New ADODB.Recordset
conn.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=jilu;Data Source=."
rst.Open "select * from cqwz ", conn
DataGrid1.DataSource = rst
End Sub
执行到这里 DataGrid1.DataSource = rst
总提示“编辑错误,未找到方法或数据成员”
高手赐教! 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询