Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: SQL ADO.NET
Consider example where a windows form need to be created to display the product recorder data having record value equal to 750.The data will be fetched by sending SQL command to the database with the help of DbCommand object.
Posted 5-Jan-13 0:25am
onurag19 at 5-Jan-13 6:33am
what do you want to ask ?
Sheikh Muhammad Haris at 7-Jan-13 0:29am
Really, didn't even get what you want to ask :)
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Introduction to ADO.Net: Tutorial[^].
The best place to start when you are learning something new is a simple tutorial. These can almost always be found very quickly by typing a couple of your primary subjects into the search bar in google.
Sandeep Mewara at 13-Jan-13 3:26am
Yep. A 5!
Marcus Kramer at 14-Jan-13 11:15am
Thanks, Sandeep.
Maciej Los at 14-Jan-13 14:47pm
Agree! +5!
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Assuming that your Sql connection is already created and also your sql command. This code can be called; you pass you sql command and your connection variable to it, it will return a datatable back to you to process and display in your form.
 public DataTable ProcessCommand(string sql, SqlConnection conn)
            SqlCommand _MiscCommand = default(SqlCommand);
            if (conn.State == ConnectionState.Closed)
                _MiscCommand = new SqlCommand(sql, conn);
                DataSet rsMiscAdapter = new SqlDataAdapter(_MiscCommand);
                DataTable table = new DataTable();
                return table;
            catch (Exception )
                return null;

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Schatak 394
1 OriginalGriff 300
2 Abhijit Ghosh (Subho) 125
3 _Amy 115
4 Andreas Gieriet 110
0 OriginalGriff 7,137
1 Sergey Alexandrovich Kryukov 5,628
2 Maciej Los 3,529
3 Peter Leow 3,373
4 DamithSL 2,505

Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 13 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100