Click here to Skip to main content
15,889,651 members
Home / Discussions / C#
   

C#

 
GeneralRe: TreeView--Treenode with a Checkbox bound to database Pin
billoo22-Apr-05 8:24
billoo22-Apr-05 8:24 
GeneralRe: TreeView--Treenode with a Checkbox bound to database Pin
John Fisher22-Apr-05 8:37
John Fisher22-Apr-05 8:37 
GeneralRe: TreeView--Treenode with a Checkbox bound to database Pin
billoo22-Apr-05 9:49
billoo22-Apr-05 9:49 
GeneralRe: TreeView--Treenode with a Checkbox bound to database Pin
John Fisher22-Apr-05 10:30
John Fisher22-Apr-05 10:30 
GeneralSimple Mime / mail messages Pin
ColinBashBash22-Apr-05 4:14
ColinBashBash22-Apr-05 4:14 
GeneralRe: Simple Mime / mail messages Pin
ColinBashBash25-Apr-05 4:00
ColinBashBash25-Apr-05 4:00 
GeneralData Manipulation Pin
Illegal Operation22-Apr-05 3:51
Illegal Operation22-Apr-05 3:51 
GeneralRe: Data Manipulation Pin
turbochimp22-Apr-05 4:11
turbochimp22-Apr-05 4:11 
You will want to look at the System.Data and System.Data.SqlClient namespaces.

One way to do what you're attempting would be to create a System.Data.SqlClient.SqlConnection object using a valid connection string for your database, then create a System.Data.SqlClient.SqlCommand using the connection with the name of your stored procedure as the CommandText, and StoredProcedure as the CommandType. Finally, create a System.Data.SqlClient.SqlDataAdapter object based on the SqlCommand object (there is a constructor that accepts a SqlCommand instance).

Once the DataAdapter was created, you could declare a System.Data.DataTable and call the SqlDataAdapter's Fill method to retrieve your data into the DataTable. After the data is retrieved and stored in memory in your DataTable, you can set your DataGrid's DataSource property to be the DataTable (or you can further use a System.Data.DataView of the DataTable if you want to sort your results), and call the DataGrid's DataBind method. The DataGrid should then display your results.

There's quite a lot more that can be done with configuring the DataGrid, but these are the basics. There are also several different ways you could get the data you're after using a variety of combinations of types in the System.Data namespace and its sub-namespaces, but this is fairly straightforward.

Hope this helps.

The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’

QuestionHow to set Timeout in a asynchronus WebRequest Pin
User-37793622-Apr-05 3:16
User-37793622-Apr-05 3:16 
GeneralWindows Service dont appear in Service Panel Pin
Adnan Siddiqi22-Apr-05 2:47
Adnan Siddiqi22-Apr-05 2:47 
GeneralRe: Windows Service dont appear in Service Panel Pin
John Fisher22-Apr-05 7:33
John Fisher22-Apr-05 7:33 
GeneralDataset.GetXml() problem Pin
padvit22-Apr-05 2:41
padvit22-Apr-05 2:41 
GeneralOpen a Word Document Pin
fatihsen22-Apr-05 1:52
fatihsen22-Apr-05 1:52 
GeneralRe: Open a Word Document Pin
mav.northwind22-Apr-05 2:11
mav.northwind22-Apr-05 2:11 
GeneralRe: Open a Word Document Pin
fatihsen22-Apr-05 2:21
fatihsen22-Apr-05 2:21 
GeneralRe: Open a Word Document Pin
mav.northwind22-Apr-05 2:28
mav.northwind22-Apr-05 2:28 
GeneralRe: Open a Word Document Pin
fatihsen22-Apr-05 2:38
fatihsen22-Apr-05 2:38 
GeneralRe: Open a Word Document Pin
fatihsen22-Apr-05 3:36
fatihsen22-Apr-05 3:36 
QuestionWhy when I change the ReportSource of a report, the report not change? Pin
Ana-Gabriela Clem22-Apr-05 1:39
Ana-Gabriela Clem22-Apr-05 1:39 
AnswerRe: Why when I change the ReportSource of a report, the report not change? Pin
Yulianto.22-Apr-05 19:31
Yulianto.22-Apr-05 19:31 
GeneralRe: Why when I change the ReportSource of a report, the report not change? Pin
Ana-Gabriela Clem24-Apr-05 7:28
Ana-Gabriela Clem24-Apr-05 7:28 
GeneralA question about calling an unmanaged dll Pin
Micke B22-Apr-05 1:00
Micke B22-Apr-05 1:00 
GeneralRe: A question about calling an unmanaged dll Pin
John Fisher22-Apr-05 6:45
John Fisher22-Apr-05 6:45 
GeneralRe: A question about calling an unmanaged dll Pin
Micke B22-Apr-05 7:13
Micke B22-Apr-05 7:13 
GeneralRe: A question about calling an unmanaged dll Pin
Micke B26-Apr-05 2:37
Micke B26-Apr-05 2:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.