Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

database driven webpage

Status
Not open for further replies.

vandu

Programmer
Apr 10, 2002
3
0
0
US
Hi,

I am new to asp.I have a database writen in access & a .asp code.It doesn't seem to be working.It just shows page not displayed & doesn't show the error( i am trying to test it in 7host.com as i don't have IIS or pws in windows ME).My database is odbc_exmp.mdb & my table is "names"

My code is

<% @ Language = VBScript %>
<% Response.buffer = true %>
<html>
<head>
<title>Stardeveloper.com Database Tutorial</title>
</head>
<body>
test
<% Dim conn, rs
dbfile=Server.MapPath(&quot;odbc_exmp.mdb&quot;)
strConnString=&quot;Provider=Microsoft.Jet.OLEDB.4.0;Data Source=&quot;& Server.MapPath(&quot;../odbc_exmp.mdb&quot;)
Set conn = Server.CreateObject(&quot;ADODB.Connection&quot;)
set rs = Server.CreateObject(&quot;ADODB.RecordSet&quot;)
rs.Open &quot;names&quot;

While Not rs.EOF
Response.Write &quot;ID : &quot; & rs(&quot;id&quot;) & &quot;<br>&quot;
Response.Write &quot;First Name : &quot; & rs(&quot;first_name&quot;) & &quot;<br>&quot;
Response.Write &quot;Last Name : &quot; & rs(&quot;last_name&quot;) & &quot;<br>&quot;
Response.Write &quot;<br>&quot;
rs.MoveNext
Wend

rs.Close
Set rs = Nothing %>
</body>
</html>

Any help will be greatly appreciated !! Thanks !!
 
What does the page not displayed? Are you getting a browser error but no specific line error??

Do you have Response.Buffer = True at the top of your code?? That will stop error messages from showing... Put Response.Buffer = False to fix. Otherwise, it is your free hosts IIS settings stopping it! makes it hard!

Suggestions:

1.
strConnString=&quot;Provider=Microsoft.Jet.OLEDB.4.0;Data Source=&quot;& Server.MapPath(&quot;../odbc_exmp.mdb&quot;)

Is the ../ part correct?? ie.. is the database where you are saying it is?

2.
rs.Open &quot;names&quot;

Is this an access stored procedure!? Never seen them in access like this... can you try a standard sql query and see if it fixes it?

3.
Finally, comment out every single line of code in the script and see if it runs! If it does, then uncomment one line at a time, checking that the script still works for each newly uncommented line. Thats right! One at a time until you find the problem that way! Then let us know the line that is wrong :)

Let me know how you go! Brett Birkett B.Comp
Systems Analyst
 
Hello,

Thanks for your help ! I set the response buffer to false & could solve lot of errors.
I get an error

&quot;error '80004005'
Unspecified error
/saivandana/odbc_exmp.asp, line 13&quot;

My code till now is

<% @ Language = VBScript %>
<% Response.buffer = false %>
<html>
<head>
<title>Stardeveloper.com Database Tutorial</title>
</head>
<body>
test
<% Dim conn, rs
Set conn = Server.CreateObject(&quot;ADODB.Connection&quot;)
Set rs = Server.CreateObject(&quot;ADODB.RecordSet&quot;)
conn.open(&quot;Provider=Microsoft.Jet.OLEDB.4.0;Data Source=&quot;&Server.MapPath(&quot;/saivandana/odbc_exmp.mdb&quot;))
rs.open &quot;SELECT * FROM names&quot;,conn,1,3
%>
</body>
</html>

Initially i had set rs = ... in line 13.After i changed the positions,still the line number hasn't changed !! So,now the error seems to be in the conn.open ....

Please help !!
 
Your code looks fine to me... that is if

conn.open(&quot;Provider=Microsoft.Jet.OLEDB.4.0;Data Source=&quot;&Server.MapPath(&quot;/saivandana/odbc_exmp.mdb&quot;))

has just wrapped in this window??


I would check your connection string (above). your code is ok, so it must be something to do with the connection string. Try commenting out from Set conn = down to rs.open! Then see if the script runs. If it does, you know it is one of these lines.

I would check that your path is correct. And is this running on unix?? If it is remember its case sensitive. See if you can figure out what line of code is causing the error with the commenting trick and let me know. Brett Birkett B.Comp
Systems Analyst
 
Hello,

Thanks for the solution.I renamed my MDB to a.mdb & could fit it into one single line.

in rs.open command,i am using the following code

rs.open &quot;SELECT * FROM names&quot;,conn,1,3

I get the same error

&quot;error '80004005'
Unspecified error

I tried writing the code as

sql = &quot;SELECT * FROM names&quot;
rs.open sql,conn,1,3

& then as

sql = &quot;SELECT * FROM names&quot;
rs.open sql,conn

the same error comes in rs.open line.Can you please tell me what mistake i am doing ?

Thanks !

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top