////Ado
Dim StrCon As String
StrCon = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;" _
     & "Initial Catalog=你的数据库名称;Data Source=" & 你的IP地址 & ";" _
     & "Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;" _
     & "Use Encryption for Data=False;Tag with column collation when possible=False"
            
dim AcSys  as new adodb.connection 
   With AcSys
      If .State = adStateOpen Then .Close
      .ConnectionString = StrCon
      .ConnectionTimeout = 30
      .Open
    End With

解决方案 »

  1.   

    dim ac_tmp    as new adodb.connection
    dim ar_tmp    as new adodb.recordset
    with ac_tmp
    ...
    ...
    end withtxtSQL = "select 名称 from 学生表 where 号码='"& combobox.text &"'"
    with ar_tmp
        if .state=adstateopen then .close
        .open txtSQL,ac_tmp,adopenkeyset,adlockreadonly
    end withif ar_tmp.recordcount>0 then
        text.text=ar_tmp!名称 
    else
        text.text=""
    endif
    ar_tmp.close
      

  2.   

    大力是VISUAL BASIC的程序员吗?
      

  3.   

    数据源是microsoft编程组件对不同数据库系统的抽象接口。