Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Sequence to connect and retrieve data from database useig
dataset ?

Answer Posted / reply2anwar

public SqlConnection con = new SqlConnection("server=anwar;uid=sa; pwd=s;database=Employee;");
public SqlCommand cmd;
public SqlDataAdapter da;

private void RetriveData()
{
cmd = new SqlCommand("select * from empdetails", con)
DataSet ds = new DataSet();
using(da = new SqlDataAdapter(cmd))
{

da.Fill(ds, "empdetails");
foreach(DataRow dr in ds.Tables["empdetails"].Rows)
{
txtempname.Text = dr["name"].ToString();
txtdob.Text = dr["dob"].ToString();
txtstreetname.Text = dr["street"].ToString();
} // foreach
}
}

Is This Answer Correct ?    1 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you implement locking concept for dataset?

984


I loaded the dataset with a table of 10 records. One of the records is deleted from the backend, how do you check whether all the 10 records were present while updating the data(which event and steps) and throw the exception 28 can datareader hold data from multiple tables?

1008


What is ole in excel?

922


Describe briefly an ADO.NET Dataset ?

1067


How can I retrieve two tables of data at a time by using data reader? Data reader read and forward only, how is it possible to get 2 tables of data at a time?

957


What are the rules to implement connection pooling?

1047


What DataReader class do in ADO.NET ?

1079


Difference between sqlcommand and sqlcommandbuilder?

1101


What we do with the object of ado.net dataset after using it?

1006


How to add a javaScript function in a datagrid?

1108


What are the different layers of ado.net?

1056


What are the major difference between classic ADO and ADO.NET?

996


Explain what are acid properties?

962


What is commandbuilder in ado.net?

1006


What is ado oledb and odbc?

926