For the life of me, I cannot get this code run.
Here's my code
I keep getting this error:Code:<%@ LANGUAGE="VBScript" %> <%@ Import Namespace="System.Data" %> <%@ Import Namespace="System.Data.SqlClient" %> <%@ Import Namespace="System.Data.OleDb" %> <% 'http://support.alentus.com/databases_conn_odbc.asp?Node=R&sNode=6&Exp=Y dim cs ' Connect string dim db ' Database object dim rs ' Recordset object cs = "DSN=prodlgo; UID=Sharon; PWD=sms999;" db = Server.CreateObject("ADODB.Connection") db.Open (cs) 'rs = db.Execute(" & chr(34) & "SELECT * FROM employee" & chr(34) & ")" & vbcrlf & vbcrlf rs = db.Execute("SELECT * FROM employee") if (rs.EOF = True) or (rs.BOF = True) then Response.Write ("No records were found!") else rs.MoveFirst while (rs.EOF = False) 'access table colums here in this manner Response.Write (rs("ee_emp_name")) Response.Write ("<BR>") rs.MoveNext End While Response.Write ("No more data!") end if db.Close %> <html> <head> <title>WebForm5</title> </head> <body MS_POSITIONING="GridLayout"> <form id="Form1" method="post" runat="server"> </form> </body> </html>
I'd like to use this code, however I keep getting the above error. What is <%@ Page aspcompat=true %>? Can I use this code for my version of VB.NET STD 2003?Code:The component 'ADODB.Connection' cannot be created. Apartment threaded components can only be created on pages with an <%@ Page aspcompat=true %> page directive. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Web.HttpException: The component 'ADODB.Connection' cannot be created. Apartment threaded components can only be created on pages with an <%@ Page aspcompat=true %> page directive. Source Error: Line 11: cs = "DSN=prodlgo; UID=Sharon; PWD=sms999;" Line 12: Line 13: db = Server.CreateObject("ADODB.Connection") Line 14: db.Open (cs) Line 15:
Any help would be appreciated
Thanks




Reply With Quote