I am attempting to connect to my database using ASP.Net in Expression Web. I am using the following code:
dim conn dim rs conn = server.createobject("ADODB.Connection") conn.open ("StoreDSN") rs = server.createobject("ADODB.Recordset") rs.activeconnection = conn rs.open ("SELECT ProductID, ProductName FROM ProductT") while not rs.eof response.write (rs("ProductName")) rs.movenext end while
When I navigate to the page I get the following result: System.__ComObject
Repeating for every record in the database. Any ideas?
DatabasePath = "/full/path/to/your/database/whatever.mdb"
set Conn = Server.CreateObject("ADODB.Connection")
You shouldn't need the rs.ActiveConnection line.
And remember you don't need parentheses around statements that aren't functions and don't return a value. For example:
You don't need parens around that because you aren't returning a value from it.
Kevin Robertson 2 years ago
Thank Richard, finally got it working. Initially ran into the same problem until I made the followong change:
Set is apparently no longer supported, so had to leave it off. Tried without the parentheses and got on error message. Compiler Error Message: BC30800: Method arguments must be enclosed in parentheses.
Thank you once again and keep up the great work you are doing.