Hi I'am a beginner in C#. I would like to know how to connect to a database using C#. I'am using Visual Studio 2008.

Recommended Answers

All 2 Replies

The first thing you need is a database--do you have one? Then, you need to build a proper connection string to connect to it with: http://www.connectionstrings.com/. How you proceed from here depends on the database type, but the basic, most common stuff, involves:

1) Opening a connection
2) Building a SQL command
3) Executing the command

There are infinite examples on the web, but if you cannot find some really "basic" examples for your database type, let us know what DB you are using and I'm sure we can point you to a few.


commented: informative +5

Okay thanks that helps a lot.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.