在ASP中連接到SQL Server數據庫的方法有以下幾種:
<%
Dim conn
Set conn = Server.CreateObject("ADODB.Connection")
conn.ConnectionString = "Provider=SQLOLEDB;Data Source=YourServerName;Initial Catalog=YourDatabaseName;User Id=YourUsername;Password=YourPassword;"
conn.Open
%>
<%
Dim conn
Set conn = Server.CreateObject("ADODB.Connection")
conn.ConnectionString = "Provider=SQLOLEDB;Data Source=YourServerName;Initial Catalog=YourDatabaseName;User Id=YourUsername;Password=YourPassword;"
conn.Open
%>
<%
Dim conn
Set conn = Server.CreateObject("ADODB.Connection")
conn.ConnectionString = "DSN=YourDSNName;Uid=YourUsername;Pwd=YourPassword;"
conn.Open
%>
這些是連接SQL Server數據庫的一些常用方法,具體選擇哪種方法取決于您的環境和需求。