[問題] ASP(IS5.1)要如何連接SqlServer2008 R2?
小弟是用asp搭配書的方法安裝SQL Server 2000
下載完之後,我點了安裝檔,第一次跳出視窗後沒反應
第二次再點安裝檔也是跳出視窗,但顯示出"另一個安裝程式的執行個體正在執行"
http://ppt.cc/zOWL
後來我想說之後有灌,Sql Server 2008 R2
連接資料庫是這個畫面http://ppt.cc/PMLp
請問我.sql檔裡面的內容程式碼要如何修改才會連得到sql server 2008 r2?
以下是我的程式碼
<%
Set conn=Server.CreateObject("adodb.connection")
username="sa" '登入名稱
userpas="934217" '登入密碼
CnnStr="Driver={SQL Server};Server=(Local);uid=" & username & ";pwd=" & userpas & ";database=Northwind"
Set conn=Server.CreateObject("adodb.connection")
conn.open CnnStr
SQL="Select * from Categories"
Set rs=conn.execute(SQL)
%>
<html>
<title>SQL Server 連結測試</title>
</head>
<body>
<table Border=1>
<tr>
<%
'列出欄位抬頭
For i=0 To rs.Fields.Count-2
Response.Write "<td>" & rs(i).Name & "</td>"
Next
%>
</tr>
<%
while not rs.EOF
Response.write "<tr>"
For i=0 To rs.Fields.Count-2
Response.Write "<td>" & rs(i) & "</td>"
Next
Response.write "</tr>"
rs.MoveNext
Wend
%>
</table>
</body>
</html>
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.26.251.65
→
03/20 23:37, , 1F
03/20 23:37, 1F
→
03/20 23:38, , 2F
03/20 23:38, 2F