Wednesday, March 28, 2012

simple ado.net question

conauthors = new oledbconnection ("provider......."; DATA Source=c:\Authors.mdb)

This is what i would use to set up a connection for a acces-db. I'd like to make an oledb-connection for my sql-server-db which is on a different computer in my network...

what should i use for data source?You could benefit from using the SQL optimized code in the framework... SqlConnection , SQLCommand...etc.

I always let the Server Explorer write the connection for me, and then cut and paste the code it writes and put it wherever I need it.
thank you for answering.

What do you mean by server explorer or where can i find it? :rolleyes:

I am trying it with a DSN now, looks like it works better...

cu,
You can find the Server Explorer from the View menu in the VS .Net IDE.
i see, handy! i don't see anything i can copy and paste and then use for a connection string though...

regards,
You can connect to the database with the server explorer, once you have properly connected, right-click the db in the explorer, and copy the entire string out of the connectString property.

You can also drag stored procedures onto your forms (when in Design mode), and it will automatically write the code for you.
thanks a lot!

0 comments:

Post a Comment