navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

Much ADO about nothing

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> Much ADO about nothing
Page: [1]
 
Sandalwood

 

Posts: 233
Joined: 12/18/2002
From: New Jersey!
Status: offline

 
Much ADO about nothing - 3/4/2003 9:58:43   
I am trying to use ADO to connect to my database for the first time and I am having some problems. I need to do this because I now need to split my results display into multiple pages and from what I' ve read in this forum, ADO is the way to go. Here is the code I am using, and the error that I am getting follows it:

<body>
<%
set conn=Server.CreateObject(" ADODB.Connection" )
conn.Provider=" Microsoft.Jet.OLEDB.4.0"
conn.Open " http://www.mydomain.com/fpdb/muller_recapture.mdb"
%>
</body>



Microsoft JET Database Engine error ' 80004005'

Not a valid file name.

/recapture/test.asp, line 14
rdouglass

 

Posts: 9228
From: Biddeford, ME USA
Status: offline

 
RE: Much ADO about nothing - 3/4/2003 10:48:44   
Try this:



<%
set conn=Server.CreateObject(" ADODB.Connection" )

myDSN=" Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.mappath(" /fpdb/muller_recapture.mdb" )

conn.Open myDSN
%>

(in reply to Sandalwood)
Sandalwood

 

Posts: 233
Joined: 12/18/2002
From: New Jersey!
Status: offline

 
RE: Much ADO about nothing - 3/4/2003 11:11:45   
Thanks, that found the database, but now I am getting this error:

ADODB.Recordset error ' 800a0e7d'

Operation is not allowed on an object referencing a closed or invalid connection.


Here is the script (the table is " Contacts" ):
set rs=Server.CreateObject(" ADODB.recordset" )
rs.Open " Contacts" , conn

(in reply to Sandalwood)
Doug G

 

Posts: 1189
Joined: 12/29/2001
From: SoCal
Status: offline

 
RE: Much ADO about nothing - 3/4/2003 11:21:22   
The error message indicates your db connection isn' t open when you are trying to use it to open your recordset.

If your conn.open fails with an error, the connection will remain closed.


_____________________________

======
Doug G
======

(in reply to Sandalwood)
Sandalwood

 

Posts: 233
Joined: 12/18/2002
From: New Jersey!
Status: offline

 
RE: Much ADO about nothing - 3/4/2003 11:24:42   
OK. So how do I fix it? I have only connected with a DRW in the past, so all of this is new to me. Please excuse my ignorance.

(in reply to Sandalwood)
Sandalwood

 

Posts: 233
Joined: 12/18/2002
From: New Jersey!
Status: offline

 
RE: Much ADO about nothing - 3/4/2003 13:33:54   
OK, this ADO stuff isn' t going to work. I got it to connect to the database, but I can' t format the results to match the other elements on my page. In addition, I seem to get errors when I include other database result displays on the same page. Are there any alternatives? Thanks.

(in reply to Sandalwood)
bobby

 

Posts: 11394
Joined: 8/15/1969
From: Seattle WA USA
Status: offline

 
RE: Much ADO about nothing - 3/4/2003 13:43:55   
It' ll work... it' s just new to you so it' s frustrating... I know, I' ve been connecting this way for a year now and I still get frustrated by it!

If you have some page code to display that might help, more than likely it' s just a matter of syntax or " timing" on the page...

Hang in there!

" You' ve taken your first step into a larger world..."
:)

_____________________________

If con is the opposite of pro, is Congress the opposite of progress?


:)

(in reply to Sandalwood)
Sandalwood

 

Posts: 233
Joined: 12/18/2002
From: New Jersey!
Status: offline

 
RE: Much ADO about nothing - 3/4/2003 13:51:40   
For some reason, I believe you, Bobby. OK, I' ll give it another shot. I guess I will take things one step at a time. Here is the first problem: How can I remove the cell borders from around the cells?

http://64.227.190.14/recapture/paging3.asp?pagenum=2

I want just the table to have a border like this:
http://www.thebigcarlot.com/recapture/view_all_contacts_manning2.asp?ID=7&operator_first=Dave&operator_last=Hofbauer&dealership=Manning+Agency&name_first=%&name_last=%&SortColumn=contact_created&Sort=DESC


BTW, the second URL is what I am trying to recreate.


(in reply to Sandalwood)
bobby

 

Posts: 11394
Joined: 8/15/1969
From: Seattle WA USA
Status: offline

 
RE: Much ADO about nothing - 3/4/2003 13:58:10   
quote:

How can I remove the cell borders from around the cells?


<table border=" 0" > :)

I saw your page the first time I checked... but I went back to view source to check your table properties and got an " expected Loop" error... you must be coding away like mad... :)

I noticed the white borders... it' s probably a matter of changing the props of the table...

Can you post some of your page code? View > Source won' t show me your script, only the resulting HTML...

:)

_____________________________

If con is the opposite of pro, is Congress the opposite of progress?


:)

(in reply to Sandalwood)
Sandalwood

 

Posts: 233
Joined: 12/18/2002
From: New Jersey!
Status: offline

 
RE: Much ADO about nothing - 3/4/2003 14:01:27   
Well you' re right about the mad part!:)

Here is the script:
<% Option Explicit

' ADO constants used in this page
Const adOpenForwardOnly = 0
Const adLockReadOnly = 1
Const adCmdTableDirect = &H0200
Const adUseClient = 3
%>
<html>
<head>
<style>
body { font-family : Verdana; font-size : 8pt; }
a { font-family : Verdana; font-size : 8pt; text-decoration : none; }
</style>
</head>
<body bgcolor=" #003366" >


<%
Dim connStr
connStr = " Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath(" ../fpdb/muller_recapture.mdb" )

Dim rs
Set rs = Server.CreateObject(" ADODB.Recordset" )

rs.PageSize = 5
rs.CacheSize = 5
rs.CursorLocation = adUseClient

rs.Open " Contacts" , connStr, adOpenForwardOnly, adLockReadOnly, adCmdTableDirect


If Len(Request(" pagenum" )) = 0 Then
rs.AbsolutePage = 1
Else
If CInt(Request(" pagenum" )) <= rs.PageCount Then
rs.AbsolutePage = Request(" pagenum" )
Else
rs.AbsolutePage = 1
End If
End If

Dim abspage, pagecnt
abspage = rs.AbsolutePage
pagecnt = rs.PageCount

If Not rs.EOF Then
Response.Write " PageCount : " & rs.PageCount & " <br>" & vbcrlf
Response.Write " Absolute Page : " & rs.AbsolutePage & " <br>" & vbcrlf

Response.Write " Total number of records : " & rs.RecordCount & " <br><br>" & vbcrlf

Dim fldF, intRec

Response.Write " <table border=1 bordercolor=#C9D7E0 align=center cellpadding=3 cellspacing=0><thead><tr><td>Customers</td><td>Created By</td><td>Date</td><td>Send Letter</td><td>Edit</td><td>Delete</td></tr></thead><tbody>"

For intRec=1 To rs.PageSize
If Not rs.EOF Then
Response.Write " <tr><td>" & rs(" name_first" ) & "  " & rs(" name_last" ) & " </td><td>" & rs(" operator_first" ) & " </td></tr>"

rs.MoveNext
End If
Next
Response.Write " </tbody></table><p>"

' Now showing first, next, back, last buttons.
Response.Write " <div align=" " center" " >" & vbcrlf
Response.Write " <a href=" " " & Request.ServerVariables(" SCRIPT_NAME" ) & " ?pagenum=1" " >First Page</a>"
Response.Write "  | "

If abspage = 1 Then
Response.Write " <span style=" " color:silver;" " >Previous Page</span>"
Else
Response.Write " <a href=" " " & Request.ServerVariables(" SCRIPT_NAME" ) & " ?pagenum=" & abspage - 1 & " " " >Previous Page</a>"
End If

Response.Write "  | "

If abspage < pagecnt Then
Response.Write " <a href=" " " & Request.ServerVariables(" SCRIPT_NAME" ) & " ?pagenum=" & abspage + 1 & " " " >Next Page</a>"
Else
Response.Write " <span style=" " color:silver;" " >Next Page</span>"
End If
Response.Write "  | "
Response.Write " <a href=" " " & Request.ServerVariables(" SCRIPT_NAME" ) & " ?pagenum=" & pagecnt & " " " >Last Page</a>"
Response.Write " </div>" & vbcrlf

Else
Response.Write " No records found!"
End If

rs.Close
Set rs = Nothing
%>
<div align=" center" >
<center>
<table border=" 0" cellpadding=" 0" cellspacing=" 0" style=" border-collapse: collapse" bordercolor=" #111111" width=" 798" id=" AutoNumber1" >
<tr>
<td> </td>
</tr>
</table>
</center>
</div>
</body>
</html>

(in reply to Sandalwood)
bobby

 

Posts: 11394
Joined: 8/15/1969
From: Seattle WA USA
Status: offline

 
RE: Much ADO about nothing - 3/4/2003 16:47:56   
Heres the line with the table borders... change the border to 0...

Response.Write " <table border=' 0'  align=' center'  cellpadding=' 3' 

As far as the DB connection... you have a connection string, but no connection object... like so:
Dim oConn,connStr 

set oConn=server.createobject(" ADODB.connection" )
connStr = " Provider=Microsoft.Jet.OLEDB.4.0; Data Source="  & Server.MapPath(" ../fpdb/muller_recapture.mdb" ) 
oConn.open, connStr

Dim rs 
Set rs = Server.CreateObject(" ADODB.Recordset" ) 
rs.Open " Contacts" , oConn, adOpenForwardOnly, adLockReadOnly, adCmdTableDir


I think that' s right... it' s been a long time since I' ve typed out a DB connection [:j]... at home I have a connection.txt file that has five or six different variations... I' ve been copy > pasting out of that for a long time...

If I' m wrong it still won' t work (sorry :)) but I or someone else will be back to correct my mistakes...

<edit>
afterthought...

are the <table> and </table> tags supposed to be outside ASP delimiters all the time, or only when looping... I forget?
</edit>

< Message edited by bobby -- 3/4/2003 1:50 PM >


_____________________________

If con is the opposite of pro, is Congress the opposite of progress?


:)

(in reply to Sandalwood)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> Much ADO about nothing
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts