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

Working with ACCESS databases

Status
Not open for further replies.

arlequin

Programmer
Sep 21, 1999
232
UY
Hi people!!

I know I can work with MS ACCESS databases using the ODBC or using the name and the path of the MDB file.

How can I work with the ADODB.Connection properties?



Many Thanks!!! Arlequín
arlequin@montevideo.com.uy
 
Arlequin,

You put the same connection information in the Connection.Open() method then use the 'Connection' object as the parameter to Recordset.Open(), i.e.,

var conn = Server.CreateObject("ADODB.Connection");
conn.Open( connectString);
var rs = Server.CreateObject("ADODB.Recordset");
rs.Open( "Select * from Authors", conn, .....);

Hope this helps
-pete
 
I would use explicit setting of properties rather than passing the information as parameters to methods. It means writing a few extra lines of code, but it is more efficient and more maintainable.
Try:

Code:
dim cnDBCon, rsResults
 
SET cnDBCon = Server.CreateObject("ADODB.Connection")
cnDBCon.ConnectionString = "DSN=myDSN;"
cnDBCon.CursorLocation = 3
cnDBCon.Open

Set rsResults = Server.CreateObject("ADODB.Recordset")
Set rsResults.ActiveConnection = cnDBCon
rsResults.Source = "SELECT * FROM myTable"
rsResults.Open

James :) James Culshaw
jculshaw@active-data-solutions.co.uk
 
> so.. in the DNS I put my DNS name that points to my Access database?


Well you probably just typoed but to make sure: ;-)

DNS (Domain Name Server)
DSN (Data Source Name)

You are using a DSN

-pete
 
hahahahahaa...
thanks pete....

I'm always getting confused with Domain NAme Server and Data Source Name...

:) LOL... :)

OK...
let's say that I have to point to my DSN...

ok? Arlequín
arlequin@montevideo.com.uy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top