Beginner question:

Can anyone point me in the right direction for learning (url's, books, etc.)
how to connect to an sql or access database through code rather than using
typed datasets? What I am most interested in is sample code that would
connect to say the Northwind database and allow a user to insert, delete,
update data from the tables.

I want the user to first select the location of the database he wants to
connect to, then to load my datagridview with the datasource/ tableadapter
etc.

Thanks for all responses.
Peter

Re: How to connect to a database through code? by Cor

Cor
Tue Mar 04 23:25:28 CST 2008

Peter,

In my idea you need a book and then a practical one like Hitchhiker's Guide
to Visual Studio and SQL Server (7th Edition) by
William Vaughn.

For connecting it is only needed:

Dim conn as new DBConnection("connectionString) 'VB
and the little bit more wordy
DBConnection conn = new DBConnection("connectionString'); //C#

Where DB is the provider by instance SqlClient for SQL or OleDB for Jet
(access).

Connectionstring you can find here.

www.connectionstrings.com

Cor


Re: How to connect to a database through code? by Miro

Miro
Wed Mar 05 08:22:26 CST 2008

I have been going through a book recommended here,

"Programming Microsoft ADO.Net 2.0 Core Reference by David Sceppa"
( its a microsoft book )

and I am very pleased with it so far - gives you and walks you through
plenty of examples of going through code to hit the database.

Miro

<peter.taslimi@hotmail.com> wrote in message
news:10EC6980-402F-4E28-94EA-F30F563973F3@microsoft.com...
> Beginner question:
>
> Can anyone point me in the right direction for learning (url's, books,
> etc.) how to connect to an sql or access database through code rather than
> using typed datasets? What I am most interested in is sample code that
> would connect to say the Northwind database and allow a user to insert,
> delete, update data from the tables.
>
> I want the user to first select the location of the database he wants to
> connect to, then to load my datagridview with the datasource/ tableadapter
> etc.
>
> Thanks for all responses.
> Peter
>
>


RE: How to connect to a database through code? by Saimvp

Saimvp
Thu Mar 06 03:07:00 CST 2008

Hi and Hello.
You can use this book titled "c# database 2008 Novice to Prof"
It's all about database programming.

For Connecting in database using code:

//VB
Dim conn as new DBConnection(connectionString)
//C#
DBConnection conn = new DBConnection(connectionString);

Where DB is the provider by instance SqlClient, OleDB

--
To be Happy is To be Yourself


"peter.taslimi@hotmail.com" wrote:

> Beginner question:
>
> Can anyone point me in the right direction for learning (url's, books, etc.)
> how to connect to an sql or access database through code rather than using
> typed datasets? What I am most interested in is sample code that would
> connect to say the Northwind database and allow a user to insert, delete,
> update data from the tables.
>
> I want the user to first select the location of the database he wants to
> connect to, then to load my datagridview with the datasource/ tableadapter
> etc.
>
> Thanks for all responses.
> Peter
>
>

Re: How to connect to a database through code? by codeman

codeman
Fri Mar 07 02:36:35 CST 2008

I learned a lot from the book:

Pro ADO.NET 2.0,
Sahil Malik,
Apress

Op Tue, 4 Mar 2008 07:53:52 -0500 schreef <peter.taslimi@hotmail.com>:

>Beginner question:
>
>Can anyone point me in the right direction for learning (url's, books, etc.)
>how to connect to an sql or access database through code rather than using
>typed datasets? What I am most interested in is sample code that would
>connect to say the Northwind database and allow a user to insert, delete,
>update data from the tables.
>
>I want the user to first select the location of the database he wants to
>connect to, then to load my datagridview with the datasource/ tableadapter
>etc.
>
>Thanks for all responses.
>Peter
>