想配置一个系统DNS,通过SQLServer联接数据库,名称为sw,服务器名为192.16.0.1,SQL的登录用户名为SA,密码为123456,使用TCP/IP,代码应该怎么写?请各位大哥帮帮忙

解决方案 »

  1.   

    ADODC1.ConnectionString = "连接字符串" 
    ADODC1.CommandType = adCmdText 
    ADODC1.RecordSource = "select * from 表名" 
    ADODC1.Recordset.Open "增、删、改的SQL语句", "连接字符串" 
      

  2.   

    手上只有PB代码你也参考一下把// Profile test
    SQLCA.DBMS = "MSS Microsoft SQL Server 6.x"
    SQLCA.Database = "SQLTest"
    SQLCA.ServerName = "本机名"
    SQLCA.AutoCommit = False
    SQLCA.DBParm = "OptSelectBlob=1,DateTimeAllowed='Yes',Secure=1"
      

  3.   

    //vb用odbc的写法
    DIM fk_server As New ADODB.Connection
    Dim record As New ADODB.Recordsetfk_server.ConnectionString="DSN=" & DSN_name & ";UID=" & UID_name & ";PWD=" & PWD_name & ";Database=" & database_name_FK & ";"
     If fk_server.State = 0 Then
        fk_server.Open
      End If
    Set record.ActiveConnection = fk_server
      record.CursorLocation = adUseClient
      record.CursorType = adOpenStatic
      record.LockType = adLockOptimistic
      record.Source = sql
      record.Open
    ...
      

  4.   

    我也想知道.顶.
    你参考下,能运行了告诉我下.
    Dim   mystring   As   String   *   255 
            Dim   driver   As   String   *   64 
            Dim   retcode   As   Integer 
            driver   =   "SQL   Server "   &   Chr$(0) 
            mystring   =   "dsn=erp "   &   Chr$(0)   _ 
                              &   "DESCRIPTION=描述 "   &   Chr$(0)   _ 
                              &   "Server=(local) "   &   Chr$(0)   _ 
                              &   "Useprocforprepare=yes "   &   Chr$(0)   _ 
                              &   "OEMTOANSI=no "   &   Chr$(0)   _ 
                              &   "DATABASE=ERP1 "   &   Chr$(0)   _ 
                              &   "network=DBMSSOCN "   &   Chr$(0)   &   Chr$(0)
      

  5.   

    我也想知道.顶.
    你参考下,能运行了告诉我下.
    Dim   mystring   As   String   *   255 
            Dim   driver   As   String   *   64 
            Dim   retcode   As   Integer 
            driver   =   "SQL   Server "   &   Chr$(0) 
            mystring   =   "dsn=erp "   &   Chr$(0)   _ 
                              &   "DESCRIPTION=描述 "   &   Chr$(0)   _ 
                              &   "Server=(local) "   &   Chr$(0)   _ 
                              &   "Useprocforprepare=yes "   &   Chr$(0)   _ 
                              &   "OEMTOANSI=no "   &   Chr$(0)   _ 
                              &   "DATABASE=ERP1 "   &   Chr$(0)   _ 
                              &   "network=DBMSSOCN "   &   Chr$(0)   &   Chr$(0)