P
PW
If I am using ASP and access an Access database, but I am not using ADO,
what is the name of the database methodology I am using ?
what is the name of the database methodology I am using ?
PW said:If I am using ASP and access an Access database, but I am not using
ADO, what is the name of the database methodology I am using ?
Bob Barrows said:Are we supposed to read your mind? Give us an example.
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
PW said:Apoogies for not posting an example before ...
<td>
myDSN="DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Session("SystemDatabaseName")
set rs1=server.createobject("adodb.recordset")
Apoogies for not posting an example before ...
<td>
myDSN="DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Session("SystemDatabaseName")
set rs1=server.createobject("adodb.recordset")
rs1.CursorLocation = 3
rs1.CursorType = 3
Well, you ARE using ADO (see that "adodb.recordset" line?). What you are
doing is using the deprecated MSDASQL provider (which is loaded by default
when you don't specify a provider in your connection string) to connect to
the obsolete Access ODBC driver.
By reading this sentence, you should get an idea about why this practice
is not recommended, even if I had left out the words "deprecated" and
"obsolete": by making ADO use a provider to communicate with a separate
data access library, you are adding an extra, and unnecessary, layer of
software between your code and the database.
Simply use the native Jet OLE DB provider. The only time the MSDASQL
provider should be used is when a native provider for your database does
not exist, or does not provide the functionality you need. Neither of
these is the case with Jet.
The other thing you are doing, also highly discouraged BTW, is failing to
use an explicit connection object. By supplying a string instead of a
connection object in the rs.open statement, you are causing ADO to open an
implicit connection. This is bad because:
1. You have no direct control over the connection and thus cannot
explicitly close it without accessing the recordset's ActiveConnection
property.
2. Using implicit connections can disable ADO Session Pooling, resulting
in too many connections being opened to the database.
Always create and open an explicit connection object and use it for
subsequent database activity. You are not really saving yourself any time
when you use implicit connections, and you could definitely be causing
problems for your web server.
PW said:Ok, I have replaced my connection string with ...
myDSN = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Session("SystemDatabaseName")
I'm not quite sure what change to make to change to an explicit connection
object. Can you give me an example?
TIA,
PW
dim cnPW said:Ok, I have replaced my connection string with ...
myDSN = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Session("SystemDatabaseName")
I'm not quite sure what change to make to change to an explicit
connection object. Can you give me an example?
set cn=createobject("adodb.connection")
cn.open myDSN
...
rs1.open mySQL,cn,,,1
or
set rs1=cn.Execute(mySQL,,1)
And, while we're at it:
http://www.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&[email protected]
http://groups.google.com/groups?hl=...=1&[email protected]
http://groups-beta.google.com/group/microsoft.public.inetserver.asp.db/msg/72e36562fee7804e
PW said:I think I'm already doing that in a round-about fashion ... this is
what I have in my "settings.asp"....
myDSN = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Session("SystemDatabaseName")
set rs1=server.createobject("adodb.recordset")
rs1.CursorLocation = 3
rs1.CursorType = 3
To do it the way you suggest would be ...
dim cn
myDSN = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Session("SystemDatabaseName")
set rs1=createobject("adodb.connection")
rs1.open myDSN
set rs1=cn.Execute(mySQL,,1)
Almost.Is that correct?
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.