我在代码中写ADO控件的连接代码,下面代码哪出了问题,为什么数据库没打开???   Adodc1.ConnectionString = "Provider=SQLOLEDB.1;Persist Security    Info=False;User ID=sa;Initial Catalog=crm;Data Source=ZHUYAN"
   Adodc1.RecordSource = "select * from custom"

解决方案 »

  1.   

    Adodc1.ConnectionString = "Provider=SQLOLEDB.1;Persist Security    Info=False;User ID=sa;Initial Catalog=crm;Data Source=ZHUYAN"
       Adodc1.RecordSource = "select * from custom"
    '=================添加
    adodc1.refresh
    '===================
      

  2.   


       Adodc1.ConnectionString = "Provider=SQLOLEDB.1;Persist Security    Info=False;User ID=sa;Initial Catalog=crm;Data Source=ZHUYAN"
       Adodc1.RecordSource = "select * from custom"
       
       Adodc1.Refresh设置好ADO控件的连接后要将ADO控件刷新一下。
      

  3.   

    在摸板级:
    Public adoCnn As New ADODB.Connection
    Public adoRec As New ADODB.RecordsetadoCnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Autodata.mdb;Persist Security Info=False"
    之后如果要打开某表(TB_KH):
    adoRec.Open "select * from [tb_kh] ", adoCnn, 3, 2