一个关于adodc控件的问题
发表在VB答疑区
2013-04-16
是否精华
是
否
版块置顶:
是
否
我的datagrid控件绑定了adodc1。希望datagrid显示SQLSERVER数据库的code表的ccode列。adodc1控件没有设置连接字符串。
代码如下:
Public PublicStr As String
Private con As New ADODB.Connection
Private rs As New ADODB.Recordset
Private Sub Form_Load()
PublicStr = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=UFDATA_004_2013;Data Source=ymomomy"
Adodc1.ConnectionString = PublicStr
'Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select ccode from code"
End Sub
最后执行的时候datagrid没有显示出任何内容,请问这是为何?
代码如下:
Public PublicStr As String
Private con As New ADODB.Connection
Private rs As New ADODB.Recordset
Private Sub Form_Load()
PublicStr = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=UFDATA_004_2013;Data Source=ymomomy"
Adodc1.ConnectionString = PublicStr
'Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select ccode from code"
End Sub
最后执行的时候datagrid没有显示出任何内容,请问这是为何?