View Single Post
 
Old October 15th, 2003, 01:05 AM
TEDY TEDY is offline
Authorized User
 
Join Date: Oct 2003
Location: , , .
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to TEDY Send a message via MSN to TEDY
Default

hey i'm going to do same way probably...

i been thinking about using:

sqlcon
sql data adapter
dataset
datagrid

so i think :

fill a dataset with data from the data source, and upddate the data source with any changes made in the dataset.

this.sqlDataAdapter.Fill(this.ds, "Name of Table");
Meanwhile you can add a DataGrid etc....
using commands like delete,insert,select

So basically reading Data with the DataSet looks like:

- fill the dataset with data
- access tables, rows and columns in the dataset

using System;
using System.Data;
using System.Data.SqlClient;

public static void Main()

SqlConnection thisConnection = new SqlConnection

@"DataSource=(local);Integrated Security=SSPI;" + "Initial Catalog=northwing");

SqlDataAdapter thisAdapter = new SqlDataAdapter;
("SELECT CustomerID, ContactName FROM Customers"; thisConnection);

DataSet thisDataSet = new Dataset();

thisAdapter.Fill(thisDataSet, "Customers");
foreach(DataRow theRow in this DataSet.Tables["Customers"].Rows)
{
  Console.WriteLine(theRow["CustomersID"] + "\t" + theRow["ContactName"]);
}