NEO
05-26-2003, 04:53 PM
Hi, im now started to learn about databases.
Im trying to show the database using asp. Ive used the following code but its not working.
------------------------------------------------------------------------------------
<%
dim oconn
dim oRS
dim strSource
set oConn=server.createobject("ADODB.connection")
set ors=server.createobject("ADODB.recordset")
strsource = "driver={microsoft access driver (*.mdb)}"
strsource = strsource & "; DBQ=c:/autograph.mdb"
oconn.connectionstring = strsource
oconn.open
sqltext = "select namefirst"
sqltext = sqltext & " FROM admin WHERE adminname=2;"
oRS.Open sqltext, oConn
response.Write "<table border-1><tr>"
response.Write ors.GetString(,-1,"</td><td>","</td></tr><td>"," ")
response.Write "</td></tr></table>"
ors.Close
set ors=nothing
oconn.Close
set oconn=nothing
%>
But i get this error message!
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E10)
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 2.
/database.asp, line 15
The database name is called "Autograph.asp" the tabe is called "Admin" and the colum im wanting to display is called "Name"
Whats the problem, because Im learning this out of a book & Its saying Its wrong ??
Im trying to show the database using asp. Ive used the following code but its not working.
------------------------------------------------------------------------------------
<%
dim oconn
dim oRS
dim strSource
set oConn=server.createobject("ADODB.connection")
set ors=server.createobject("ADODB.recordset")
strsource = "driver={microsoft access driver (*.mdb)}"
strsource = strsource & "; DBQ=c:/autograph.mdb"
oconn.connectionstring = strsource
oconn.open
sqltext = "select namefirst"
sqltext = sqltext & " FROM admin WHERE adminname=2;"
oRS.Open sqltext, oConn
response.Write "<table border-1><tr>"
response.Write ors.GetString(,-1,"</td><td>","</td></tr><td>"," ")
response.Write "</td></tr></table>"
ors.Close
set ors=nothing
oconn.Close
set oconn=nothing
%>
But i get this error message!
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E10)
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 2.
/database.asp, line 15
The database name is called "Autograph.asp" the tabe is called "Admin" and the colum im wanting to display is called "Name"
Whats the problem, because Im learning this out of a book & Its saying Its wrong ??