ADO.Net step by step

This is a discussion on ADO.Net step by step within the C# Programming forums, part of the General Programming Boards category; howdy~ i used to code with ASP and now want to touch something on ASP.Net, fist i wonder how can ...

  1. #1
    flashing vampire black's Avatar
    Join Date
    May 2002
    Posts
    563

    ADO.Net step by step

    howdy~

    i used to code with ASP and now want to touch something on ASP.Net, fist i wonder how can i make connections with ADO.Net, i checked some tutos and find there must be 3 or 4 steps for achieve this. for i know first is to import System.Data.SqlClient class and build an instance of it, but get confused next steps ? anyone can share example code here plz ?
    Never end on learning~

  2. #2
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,138
    PHP Code:
    SqlConnection connection;

                try
                {
                    
    connection = new SqlConnection();
                    
    connection.ConnectionString "yourconnectstring:databasevendordependent";
                    
    connection.Open();
                }
                catch( 
    SqlException exception )
                {
                    
    // error occurred, handle it here
                

    The database connection string depends on the database server you have. I think the SqlConnection was meant to connect to an MS Sql Server. There are interfaces called IDbConnection and IDbCommand. Each database system can provide so-called data-providers for .NET to connect to their database system. Those implement the interfaces. For SQL Server its System.Data.SqlClient, for Oracle it's called ODP.NET and can be downloaded from Oracle or you can use the Microsoft drivers for Oracle. I don't know how they are called and I think you should use the drivers from the database vendor anyway.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. debugging - step into issue
    By barneygumble742 in forum C++ Programming
    Replies: 7
    Last Post: 03-15-2009, 12:30 PM
  2. recursion
    By paulmedic555 in forum C Programming
    Replies: 26
    Last Post: 01-27-2005, 11:43 PM
  3. robot step sizes
    By n00by in forum C Programming
    Replies: 2
    Last Post: 04-29-2004, 03:29 PM
  4. step by step debug != run debug
    By bonkey in forum Windows Programming
    Replies: 8
    Last Post: 09-09-2002, 12:55 PM
  5. this sites Compiler Resources Specs.
    By Powerfull Army in forum C++ Programming
    Replies: 9
    Last Post: 07-08-2002, 06:12 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21