请问,如何连接SQL server数据库?谢谢!
我现在用的是Access数据库,目前用以下方式连接,虽然也是一知半解,但用的还好
Set Cnn = CreateObject("ADODB.Connection")
With Cnn
.Provider = "Microsoft.Jet.OLEDB.4.0"
.Open DBFullName
Set NewRecorders = CreateObject("ADODB.Recordset")
NewRecorders.CursorLocation = 3
NewRecorders.ActiveConnection =Cnn
NewRecorders.Open Source:=SQLtxt, CursorType:=2, LockType:=2, Options:=1
请问,如何改成连接SQL server数据库的方法啊?谢谢!
------解决方案--------------------SqlConnection conn = new SqlConnection(“连接字符串”);
conn.Open();
------解决方案-------------------- Set Conn = CreateObject("ADODB.Connection") Connstr="driver={sqlserver};uid=sa;pwd=123456;database=表名"
------解决方案--------------------
set Cnn= server.CreateObject("adodb.connection")
Cnn.Open "driver={SQL Server};server=[服务器名];uid=[帐号];pwd=[密码];database=[数据库名]"