By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,105 Members | 1,040 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,105 IT Pros & Developers. It's quick & easy.

Can't connect To MS Access DB with ASP

P: n/a
Hey,

I just started working at this new company and they gave me a simple
database project to start with. yet I am starting to look like an
idiot cause I can't even seem to connect to the MS Access DB with ASP.

I already went into Data Sources (ODBC) with windows Control panel and
set up a DSN. I don't think that is the problem. I am no expert at
all at asp...

can anyone see what I am doign wrong here? The name of my Data Source
is "order" and the actual database is order.mdb

If anyone can help me out or point me in the right direct I would be
very greatful!!!

Ryan Ritten

P.S. when I try and run this script froma browser, it always says
"This page cannot be displayed"
<%
'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsGuestbook 'Holds the recordset for the records in the database
Dim strSQL 'Holds the SQL query to query the database

'Create an ADO connection object
Set adoCon = Server.CreateObject("ADODB.Connection")

'Set an active connection to the Connection object using DSN
connection
adoCon.Open "DSN=order"

'Create an ADO recordset object
Set rsGuestbook = Server.CreateObject("ADODB.Recordset")

'Initialise the strSQL variable with an SQL statement to query the
database
strSQL = "SELECT * from order;"

'Open the recordset with the SQL query
rsGuestbook.Open strSQL, adoCon

'Reset server objects
rsGuestbook.Close
Set rsGuestbook = Nothing
Set adoCon = Nothing
%>
Nov 12 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Just opening a recordset doesn't actually do anything. You need to write the
contents of the recordset out to the screen.

Take a look at http://www.learnasp.com/learn/dbtable.asp for one approach

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(No private e-mails, please)

"Ryan Ritten" <sp*************@thesparticusarena.com> wrote in message
news:f4*************************@posting.google.co m...
Hey,

I just started working at this new company and they gave me a simple
database project to start with. yet I am starting to look like an
idiot cause I can't even seem to connect to the MS Access DB with ASP.

I already went into Data Sources (ODBC) with windows Control panel and
set up a DSN. I don't think that is the problem. I am no expert at
all at asp...

can anyone see what I am doign wrong here? The name of my Data Source
is "order" and the actual database is order.mdb

If anyone can help me out or point me in the right direct I would be
very greatful!!!

Ryan Ritten

P.S. when I try and run this script froma browser, it always says
"This page cannot be displayed"
<%
'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsGuestbook 'Holds the recordset for the records in the database
Dim strSQL 'Holds the SQL query to query the database

'Create an ADO connection object
Set adoCon = Server.CreateObject("ADODB.Connection")

'Set an active connection to the Connection object using DSN
connection
adoCon.Open "DSN=order"

'Create an ADO recordset object
Set rsGuestbook = Server.CreateObject("ADODB.Recordset")

'Initialise the strSQL variable with an SQL statement to query the
database
strSQL = "SELECT * from order;"

'Open the recordset with the SQL query
rsGuestbook.Open strSQL, adoCon

'Reset server objects
rsGuestbook.Close
Set rsGuestbook = Nothing
Set adoCon = Nothing
%>

Nov 12 '05 #2

P: n/a
Shaweet web site!

rh

"Douglas J. Steele" <NOSPAM_djsteele@NOSPAM_canada.com> wrote in message
news:Rn******************@twister01.bloor.is.net.c able.rogers.com...
Just opening a recordset doesn't actually do anything. You need to write the contents of the recordset out to the screen.

Take a look at http://www.learnasp.com/learn/dbtable.asp for one approach

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(No private e-mails, please)

"Ryan Ritten" <sp*************@thesparticusarena.com> wrote in message
news:f4*************************@posting.google.co m...
Hey,

I just started working at this new company and they gave me a simple
database project to start with. yet I am starting to look like an
idiot cause I can't even seem to connect to the MS Access DB with ASP.

I already went into Data Sources (ODBC) with windows Control panel and
set up a DSN. I don't think that is the problem. I am no expert at
all at asp...

can anyone see what I am doign wrong here? The name of my Data Source
is "order" and the actual database is order.mdb

If anyone can help me out or point me in the right direct I would be
very greatful!!!

Ryan Ritten

P.S. when I try and run this script froma browser, it always says
"This page cannot be displayed"
<%
'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsGuestbook 'Holds the recordset for the records in the database
Dim strSQL 'Holds the SQL query to query the database

'Create an ADO connection object
Set adoCon = Server.CreateObject("ADODB.Connection")

'Set an active connection to the Connection object using DSN
connection
adoCon.Open "DSN=order"

'Create an ADO recordset object
Set rsGuestbook = Server.CreateObject("ADODB.Recordset")

'Initialise the strSQL variable with an SQL statement to query the
database
strSQL = "SELECT * from order;"

'Open the recordset with the SQL query
rsGuestbook.Open strSQL, adoCon

'Reset server objects
rsGuestbook.Close
Set rsGuestbook = Nothing
Set adoCon = Nothing
%>


Nov 12 '05 #3

P: n/a
Ryan Ritten wrote:
Hey,

I just started working at this new company and they gave me a simple
database project to start with. yet I am starting to look like an
idiot cause I can't even seem to connect to the MS Access DB with ASP.

I already went into Data Sources (ODBC) with windows Control panel and
set up a DSN. I don't think that is the problem. I am no expert at
all at asp...

can anyone see what I am doign wrong here? The name of my Data Source
is "order" and the actual database is order.mdb

If anyone can help me out or point me in the right direct I would be
very greatful!!!

Ryan Ritten

P.S. when I try and run this script froma browser, it always says
"This page cannot be displayed"
<%
'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsGuestbook 'Holds the recordset for the records in the database
Dim strSQL 'Holds the SQL query to query the database

'Create an ADO connection object
Set adoCon = Server.CreateObject("ADODB.Connection")

'Set an active connection to the Connection object using DSN
connection
adoCon.Open "DSN=order"

'Create an ADO recordset object
Set rsGuestbook = Server.CreateObject("ADODB.Recordset")

'Initialise the strSQL variable with an SQL statement to query the
database
strSQL = "SELECT * from order;"

'Open the recordset with the SQL query
rsGuestbook.Open strSQL, adoCon

'Reset server objects
rsGuestbook.Close
Set rsGuestbook = Nothing
Set adoCon = Nothing
%>


Ryan,

One thing to do is go to Tools --> Internet Options --> Advanced in IE,
and clear the checkbox that says "Show friendly HTTP error messages" if
it is checked. This will often give a lot more detail about what is
failing. You can rerun your page and see if you get a more descriptive
error message.

Another is to consider using a DSN-less connection. See:

http://www.aspfaq.com/show.asp?id=2126

If the code you post above worked without error, you'd still get a blank
screen, because you aren't displaying any of the data you're trying to
get. For testing purposes you can just try to print some value from the
first row.

--

Peter
Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.