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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help desperately needed

Status
Not open for further replies.

jjdesigns

Programmer
Apr 25, 2002
12
GB
Hi, i am making a database in Access, and using it with Front Page. I have entered the coding in ASP but the database doesnt seem to be appearing on the screen. This is the coding I have used:

<%
Dim strConnect

strConnect = &quot;Provider=Microsoft.Jet.OLEDB.OLEDB.4.0;Data Source=&quot; & server.mappath(&quot;estimates.mdb&quot;)

Dim objRS

Dim totalprice, itemprice, itemname

Set objRS = Server.CreateObject(&quot;ADODB.Recordset&quot;)
objRS.Open &quot;Jobs&quot;, strConnect, adOpenStatic, adLockReadOnly, CmdTable

Response.Write &quot;<TABLE BORDER=&quot;&quot;0&quot;&quot; width=&quot;&quot;100%&quot;&quot;>
Response.Write &quot;<TR>&quot;
Response.Write &quot;<TD width=&quot;&quot;300&quot;&quot;><font size=&quot;&quot;1&quot;&quot; face=&quot;&quot;Verdana&quot;&quot;><B>Job Description</B></font></td>&quot;
Response.Write &quot;<TD width=&quot;&quot;100&quot;&quot;><font size=&quot;&quot;1&quot;&quot; face=&quot;&quot;Verdana&quot;&quot;><B>Job Quote</B></font></td>&quot;
Response.Write &quot;<TD width=&quot;&quot;100&quot;&quot;><font size=&quot;&quot;1&quot;&quot; face=&quot;&quot;Verdana&quot;&quot;><B>Click Here</B></font></td>&quot;

If Not objRS.EOF Then
While NOT objRS.EOF
Response.Write &quot;<TR>&quot;
Response.Write &quot;<TD valign=&quot;&quot;top&quot;&quot;><font size=&quot;&quot;1&quot;&quot; face=&quot;&quot;Verdana&quot;&quot;>&quot; & objRS(&quot;Job Description&quot;) & &quot; </font></TD>&quot;
Response.Write &quot;<TD valign=&quot;&quot;top&quot;&quot;><font size=&quot;&quot;1&quot;&quot; face=&quot;&quot;Verdana&quot;&quot;>&quot; & objRS(&quot;Job price&quot;) & &quot; </font></TD>&quot;
Response.Write &quot;<TD vaiign=&quot;&quot;top&quot;&quot;><font size=&quot;&quot;1&quot;&quot; face=&quot;&quot;Verdana&quot;&quot;> </font></TD>&quot;
objRS.MoveNext
Wend
End If

Response.Write &quot;</TABLE>&quot;
objRS.Close
Set objRS = Nothing

%>

can someone please tell me where I have gone wrong, much appreciated...
 
The database isnt showing up in front page when i preview it...
 
Try to use
the direct path to the DB like c:\estimates.mdb so see if there is the problem, becasue on the first look it seams ok.
 
it keeps saying error. At what part of the scripting do you suggest i put the direct link (C:\estimates)?
 
In the connectionstring... This is not a bug - it's an undocumented feature...
;-)
 
i changed the line to:


strConnect = &quot;Provider=Microsoft.Jet.OLEDB.OLEDB.4.0;Data Source=&quot; & server.mappath(&quot;D:\estimates.mdb&quot;)

(The database is stored in my D drive, still nothing is happening, the database still isnt showing up...
 
The page is going blank when i hit preview in Front Page, should I publish it first?
 
Use it like this

strConn = &quot;Provider=Microsoft.Jet.OLEDB.4.0;&quot; & _
&quot;Data Source=D:\estimates.mdb;&quot; & _
&quot;User Id=admin;&quot; & _
&quot;Password=;&quot;
 
Sorry, i didnt explain what the database was meant to do. It basically holds information on different jobs, thier prices and each jod has a job ID. After i make the database visible, I am going to make it so that when you click on one of the jobs it will add up.

Its meant to be an estimates database...
 
You have to more explicit on this part
&quot;it keeps saying error&quot;, because it look good the code.
Permission is OK for the DB?
 
Should the database be visible in the preview going by what you have seen in the coding? maybe i should publish the web page...
 
Try this...
Code:
<%
Dim strConn
strConn = &quot;Provider=Microsoft.Jet.OLEDB.4.0;&quot; & _
&quot;Data Source=D:\estimates.mdb;&quot; & _
&quot;User Id=admin;&quot; & _
&quot;Password=;&quot;

Dim objCONN, objRS
Dim totalprice, itemprice, itemname

Set objCONN = Server.CreateObject(&quot;ADODB.Connection&quot;)

objCONN.Open strConn
Set objRS = Server.CreateObject(&quot;ADODB.Recordset&quot;)
objRS.Open &quot;SELECT JobId, [Job Description], [Job price] FROM Jobs&quot;, objCONN, 1, 3
if NOT (objRS.bof AND objRS.eof) then
	arrJobs = objRS.GetRows
end if
objRS.Close
set objRS = Nothing
objCONN.Close
set objCONN = Nothing

Response.Write &quot;<TABLE BORDER=&quot;&quot;0&quot;&quot; width=&quot;&quot;100%&quot;&quot;>
Response.Write &quot;<TR>&quot;
Response.Write &quot;<TD width=&quot;&quot;300&quot;&quot;><font size=&quot;&quot;1&quot;&quot; face=&quot;&quot;Verdana&quot;&quot;><B>Job Description</B></font></td>&quot;
Response.Write &quot;<TD width=&quot;&quot;100&quot;&quot;><font size=&quot;&quot;1&quot;&quot; face=&quot;&quot;Verdana&quot;&quot;><B>Job Quote</B></font></td>&quot;
Response.Write &quot;<TD width=&quot;&quot;100&quot;&quot;><font size=&quot;&quot;1&quot;&quot; face=&quot;&quot;Verdana&quot;&quot;><B>Click Here</B></font></td>&quot;
            
If varType(arrJobs) > 8191 then
	for t = 0 to ubound(arrJobs,2)
		Response.Write &quot;<TR>&quot;
		Response.Write &quot;<TD valign=&quot;&quot;top&quot;&quot;><font size=&quot;&quot;1&quot;&quot; face=&quot;&quot;Verdana&quot;&quot;>&quot; & arrJobs(1,t) & &quot; </font></TD>&quot;
		Response.Write &quot;<TD valign=&quot;&quot;top&quot;&quot;><font size=&quot;&quot;1&quot;&quot; face=&quot;&quot;Verdana&quot;&quot;>&quot; & arrJobs(2,t) & &quot; </font></TD>&quot;
		Response.Write &quot;<TD valign=&quot;&quot;top&quot;&quot;><a href='url.asp?jobid=&quot; & arrJobs(0,t) & &quot;><font size=&quot;&quot;1&quot;&quot; face=&quot;&quot;Verdana&quot;&quot;>Click here</font></a></TD>&quot;
		response.write &quot;</tr>&quot;
	next
else
	response.write &quot;<tr><td colspan=3 valign=&quot;&quot;top&quot;&quot;><font size=&quot;&quot;1&quot;&quot; face=&quot;&quot;Verdana&quot;&quot;>Sorry: No jobs at this time...</font></td></tr>&quot;
End If
Response.Write &quot;</TABLE>&quot;
%>
This is not a bug - it's an undocumented feature...
;-)
 
Oh yeah:
you might want to exchange this:
Code:
Dim totalprice, itemprice, itemname
with this:
Code:
Dim arrJobs()
This is not a bug - it's an undocumented feature...
;-)
 
I don't know about preview. Publish it and then you will have also more err description
 
If you published the page, you have also a better description of the error. Tell us what is displayed in browser
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top