Select * from EMP;
Interested in mastering .NET? Learn more about ".NET Training" in this blog post.
Program to prove that Data set is connections less Collection of tables XML based
Using System. Data. Sql client;
Data Set ds = new Data Set ();
Code for Button 1_click (get)
{
Sql connection con = new Sql connection (“User id = sa; Password = ;
data base = north wind; Server = local Host”) ;
Sql Data Adapter d1 = new Sql Data Adapter (“Select * from products” , con);
Sql Data Adapter d2= new Sql Data Adapter (“Select * from orders ” , con);
D1.Fill (ds, “pr”); D2.Fill (ds,”or”);
Message Box. Show (“Data is ready”);
Code for Button 2_click
(products)
DS----Tables or 1
{
Data Grid view 1. Data Source = ds . Tables [“Pr”];
or ds. Tables [0];
}
Code for Button 3_click (orders)
{
Data Grid view 1. Data Source = ds. Tables [“or”];
or ds. Tables [1];
}
Code for Button 4_click (XML)
{
Ds. Write XML (“C: //abc.XML”)
Message Box. Show 1 (“File is created”);
}
25 columns
Note:- Oracle client namespace is not available at the default scope of the project, hence System. Data. Oracle client Assembly needs to be added.
Using System. Data. Oracle client
Static oracle connection con = new oracle connection (“User id = Scott; Password = tiger ”);
The provider is not required for a managed connection.
Oracle Data Adapter da = new oracle Data Adapter (“Select * from c 194”, con);
Data set ds = new Data set (); Code for Button 1_ click (get) Da. Fill (ds, “d”);
Data Grid view 1. Data Source = ds .tables [“d”];
Code for Button 2_click (save) Oracle command builder cb = new; Oracle command builder (da);
Message Box. Show (cb. Get Insert command () )
Da. Insert command = cb. Get Insert command ();
Da. Update (ds, “d”);
Message Box. Show (“Record is Added ”) ;
}
A collection of Data set Related classes is called “Data Set class Hierarchy”.
DS T1000 records
[179] [N] FIRST N =0;
LAST N = DS. Tables [‘T’]. Rows . count -1 Next N = N+1 Previous N = N-1 A program for navigating through the records
Code in GD Data table dt = new Data Table ();
Int n =0 ;
Public void Show record ()
{
Data Row dr = dt. Rows [n];
Text Box1.Text = dr [0]. To String ();
Text Box2.Text = dr [1]. To String ();
}
Code for Form 1_ load Event Sql Connection con = new sql Connection (“User id = sa; data base = north wind; Server = Local Host”);
Sql Data Adapter da = new Sql Data Adapter (“Select * from Products”, con); Data set ds = new Data set (); Da. Fill (ds, “d”);
Dt = ds . Tables [“d”];
// column Names Label 1 .Text = dt. Columns [0]. Column Name;
Label 2 .Text = dt. Columns [1]. Column Name; Show Record ();
}
{
N =0; Show Record ();
}
Code for Button2_ click (< Previous record )
{
N = n -1; If (n== -1) { Message Box. Show (“No previous Record ”);
N = 0;
}
Show Record ();
}
Code for Button 3_click (> Next Record)
{
N = n+1;
If (n > dt. Rows. Count -1 )
{
Message Box . show (“ No Next Record”);
N = dt. Rows. Count -1;
}
Show Record ();
}
Code for Butto4_ click (>> last Record)
{
N = dt. Rows . count – 1;
Show Record ();
}
You liked the article?
Like: 0
Vote for difficulty
Current difficulty (Avg): Medium
TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.