Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / March 2008

Tip: Looking for answers? Try searching our database.

Newbi question.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
pdcjlw1@gmail.com - 21 Mar 2008 16:01 GMT
Hey I'm trying to learn how to connect a database to a C# project. The
tutorial I am trying to follow says to do the following:

Creating a Database Connection
The first thing you need when retrieving data from a database is, of
course, a database connection. Although you can use the Data Adapter
Configuration Wizard to create a new database connection, the process
is easier to understand if you do it yourself the first time. To do
so, start a new Windows Application project, open the Toolbox window,
and drag a new SqlConnection object onto the form.

The only problem I have is that my toolbox does not have a
Sqlconnection object. I can't seem to find it.
This is very frustrating!

I am using Visual Studio 2005 Professional Edition.

Can anyone help?
Peter Bromberg [C# MVP] - 21 Mar 2008 17:08 GMT
SqlConnection is a class, it is not a toolbox - compatible control.  So you
would use it like this:

SqlConnection conn = new SqlConnection(
ConfigurationManager.ConnectionStrings["Northwind"].ConnectionString);
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short Urls & more: http://ittyurl.net

> Hey I'm trying to learn how to connect a database to a C# project. The
> tutorial I am trying to follow says to do the following:
[quoted text clipped - 14 lines]
>
> Can anyone help?
pdcjlw1@gmail.com - 21 Mar 2008 17:20 GMT
On Mar 21, 11:01 am, pdcj...@gmail.com wrote:
> Hey I'm trying to learn how to connect a database to a C# project. The
> tutorial I am trying to follow says to do the following:
[quoted text clipped - 14 lines]
>
> Can anyone help?

Ok. So why would my tutorial say to get it from the toolbox. That's
very confusing.
Willy Denoyette [MVP] - 21 Mar 2008 17:45 GMT
> Hey I'm trying to learn how to connect a database to a C# project. The
> tutorial I am trying to follow says to do the following:
[quoted text clipped - 14 lines]
>
> Can anyone help?

Not all Framework components are added to the toolbox per default,
SqlConnection is such component, you need to add it manually, by right
clicking "Components" and select "Choose Items.. " , from the ".Net
Framework Components" dialog select "SqlConnection" to add it to the
toolbox.

Willy.
pdcjlw1@gmail.com - 21 Mar 2008 17:52 GMT
On Mar 21, 12:45 pm, "Willy Denoyette [MVP]"
<willy.denoye...@telenet.be> wrote:
> <pdcj...@gmail.com> wrote in message
>
[quoted text clipped - 28 lines]
>
> - Show quoted text -

Ok. That makes more sense. Thanks.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.