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

What is the difference between a datareader and a dataset?

1043


What are the uses of Stored Procedure?

1067


What are the Data providers in ADO.Net?

1019


What are the different row versions available in table?

981


What is namespace in ado.net?

1022


How to bind the controls(best practice) comboboxes to the data in the dataset?

1052


What is the return type of executescalar?

1019


What is the default provider in ado.net?

967


What DataReader class do in ADO.NET ?

1101


What is difference between executequery and executeupdate?

1018


What are the advantages using ado.net?

1039


What does executequery return?

979


Which components of a data provider is used to retrieve, insert, delete, or modify data in a data source?

1147


What is two way data binding android?

994


What is the difference between the clone() and copy() methods of the dataset class?

1091