Forum Moderators: open

Message Too Old, No Replies

ASP - Access Connection

         

Zelda

10:21 pm on Dec 19, 2001 (gmt 0)



Hi there, i have a db in access and a page that is suppossed to save data in that database, I've created a System DNS that points to the db ¿how can i connect to the db in my page?

Thanks in advance

txbakers

2:53 am on Dec 20, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



var Conn = connCharms;
var Cmd = Server.CreateObject('ADODB.Command');
Cmd.ActiveConnection = Conn;

In this example, connCharms is my DSN. This connects to Access through ODBC.

KodeKrash

10:29 am on Dec 25, 2001 (gmt 0)

10+ Year Member



I am not sure where the use of the Command object comes into play when discussing a DSN connection.

Set objConnect = Server.CreateObject( "ADODB.Connection" )
objConnect.Open( "DSN-Name" )

Unless you are using the DB for other purposes (an application and web, etc), I would recommend doing a straight connection. Contrary to popular belief, there is no real performance between DSN and DSNless when using Access. This will give you a connection for access directly --

Set objConnect = Server.CreateObject( "ADODB.Connection" )
objConnect.Open( "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath( "/path/to/db.mdb" ) )

(These samples are in VBScript, not JScript, incidentally. JScript is usually not recommended for use in ASP in most instances.)