.ODBC
¡ Standard Security:
"Driver={SQL Server};Server=Aron1;Database=pubs;Uid=sa;Pwd=asdasd;"
¡ Trusted connection:
"Driver={SQL Server};Server=Aron1;Database=pubs;Trusted_Connection=yes;"
¡ Prompt for username and password:
oConn.Properties("Prompt") = adPromptAlways
oConn.Open "Driver={SQL Server};Server=Aron1;DataBase=pubs;".OLEDB, OleDbConnection (.NET)
¡ Standard Security:
"Provider=sqloledb;Data Source=Aron1;Initial Catalog=pubs;User Id=sa;Password=asdasd;"
¡ Trusted Connection:
"Provider=sqloledb;Data Source=Aron1;Initial Catalog=pubs;Integrated Security=SSPI;"
(use serverName\instanceName as Data Source to use an specifik SQLServer
instance, only SQLServer2000)
¡ Prompt for username and password:
oConn.Provider = "sqloledb"
oConn.Properties("Prompt") = adPromptAlways
oConn.Open "Data Source=Aron1;Initial Catalog=pubs;"
¡ Connect via an IP address:
"Provider=sqloledb;Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial
Catalog=pubs;User ID=sa;Password=asdasd;"

解决方案 »

  1.   

    http://www.wrox.com/dynamic/books/download.aspx
    在这里下这本书的代码。。里面有你想要的所有代码。可以好好的看。。应该来说在ASP。NET的用的对数据库的操作都有。。Beginning ASP.NET Databases Using VB.NET 这本书。。当然也可以下C#的版本。。找一下。。
      

  2.   

    .net框架自带的asp.net快速入门中就有,为什么要舍近求远呢?
      

  3.   

    '=================================
    '.NET Managed Provider Connections
    '=================================
    '
    '''''SQL Client .NET Managed Provider (System.Data.SqlClient)
    'Dim Conn As SqlClient.SqlConnection
    'Dim ConnStr As String
    '
    'ConnStr = "Data Source=(local); Initial Catalog=NorthWind; Integrated Security=SSPI; Pooling=True; Min Pool Size=10; Max Pool Size=50; Connection Lifetime=30; Connection Reset=True; Enlist=True;"
    'Conn = New SqlClient.SqlConnection(ConnStr)
    'Conn.Open()
    '
    '''''OLE DB .NET Managed Provider (System.Data.OleDb)
    'Dim Conn As OleDb.OleDbConnection
    'Dim ConnStr As String
    '
    'ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=nwind.mdb; User ID=Admin; Password=;"
    'Conn = New OleDb.OleDbConnection(ConnStr)
    'Conn.Open()