2010-11-18 5 views
0
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 

<html> 
<head> 
<title>SOP</title> 
</head> 

<body> 
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center"> 
<tr> 
<td align="left"> 

<% 
selectdata= "Select * from dbo.sop" 


set RScontest = Server.CreateObject("ADODB.Recordset") 
RScontest.ActiveConnection = "dsn=test123 ;uid=test123;pwd=test123" 
RScontest.Source = SelectData 
RScontest.CursorType = 3 
RScontest.CursorLocation = 2 
RScontest.LockType = 1 
RScontest.Open() 
if not(rscontest.bof) and not(rscontest.eof) then%> 
%> 

<table BORDER="1" align="center" width="640"> 
<caption>SOP</caption> 
<tr> 
<td>Order</td> 
<td>Department</td> 
<td>DOC Type</td> 
<td>Title</td> 
<td>Revision</td> 
<td>DOC</td> 
<td>Active</td> 

<% 
while not rscontest.eof 
%> 

<tr> 
<td> 
<%= rs("order") %> 
</td> 

<td> 
<%= rs("Department") %> 
</td> 

<td> 
<%= rs("[DOC Type]") %> 
</td> 

<td> 
<%= rs("Title") %> 
</td> 

<td> 
<%= rs("Revision") %> 
</td> 

<td> 
<%= rs("DOC") %> 
</td> 

<td> 
<%= rs("Active") %> 
</td> 

<% 
' Move to the next record 
rs.movenext 
' Loop back to the do statement 
loop %> 
</table> 

</body> 
</html> 

<% 
' Close and set the recordset to nothing 
rs.close 
set rs=nothing 
%> 

Microsoft VBScript 런타임 오류 '800a01a8'은 내가 얻는 오류입니다.asp sql 서버 연결 및 테이블

대신 OLEDB 방식으로 연결하는 데 도움이 될지 확인해 주실 수 있습니까? 나는 내 자아를 시험해 보았고 일할 수 없었다.

답변

0

코드에 데이터베이스 연결을 정의하거나 열지 못함을 나타내는 코드가 없습니다.

당신은 첫 번째를 정의하고 여기에 연결을 여는

세부 사항을 실행하고자하는 쿼리와 레코드로 전달해야합니다 http://msdn.microsoft.com/en-us/library/ms807027.aspx

그 MDSN 기사에서 코드 예제 :

Sub ConnectionExample6() 
    Dim cnn As ADODB.Connection 
    Dim rs As ADODB.Recordset 

    Set cnn = New ADODB.Connection 

    ' Open a connection by referencing the ODBC driver. 
    cnn.ConnectionString = "driver={SQL Server};" & _ 
     "server=MySqlServer;uid=MyUserName;pwd=MyPassword;database=pubs" 
    cnn.Open 

    ' Create a Recordset by executing an SQL statement. 
    Set rs = cnn.Execute("Select * From authors") 

    ' Show the first author. 
    MsgBox rs("au_fname") & " " & rs("au_lname") 

    ' Close the connection. 
    rs.Close 

End Sub 
+0

하지만 테이블을 추가하는 방법은 정확하고 어떻게이 oledb 스타일을 수행 할 수 있습니까? – MyHeadHurts