SQL connection object in 2005

Posted on 2006-06-04
Last Modified: 2010-04-16
I've been using 2003 for a while and have recently upgraded to 2005.  I can't seem to fine the sqlconnection object in the tool box, where is it??

Question by:Steve7423
    LVL 5

    Expert Comment

    The way to do it in VS 2005 is to add a new data source in the Data menu.  It will ask you for your connection string and other info in the wizard.  For more info:



    Author Comment

    ok. so the way I see it is that data controls are created via wizards rather than from objects in the tool box like in 2003.

    could you show me the way in which you would use this data object and some code to access the data.


    Author Comment

    Also, how is this done in code??  without the use of the wizard.
    LVL 5

    Accepted Solution

    If all you want to create a SqlConnection you can just do it in the code like this:

    SqlConnection conn = new  SqlConnection(/* Add the connection string here */);

    SqlDataReader reader = null;

    try {
       SqlCommand cmd = new SqlCommand("SELECT* FROM Students", conn);
       reader= cmd.ExecuteReader();
       // do stuff with your reader here.
    finally {
      if (reader!= null) rdr.Close()
      if (conn != null) conn.Close();



    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    In one of my recent projects, I was working with IP cameras, I need to take some pictures from the camera and do some processing on it. The first step, was to retrieve the image from camera into Image object. So that it can be displayed or …
    We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now