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

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

1110


What is the namespaces being used to access oracle database?

1024


What does adodb stand for?

996


What is defaultview in datatable?

1003


Explain which name space is used to get assembly details?

926


If we are not returning any records from the database, which method is to be used?

1296


What is linq and entity framework?

954


What is a string variable?

881


What property must be set and what method must be called in your code to bind the data from some data source to the Repeater control?

982


Does dapper use ado.net?

982


What is untyped dataset?

1053


Which method in OLEDBAdapter is used to populate dataset with records?

973


How can you add or remove rows from the datatable object of dataset?

986


What is difference between datatable and dataset?

1009


differences between ADO and ADO.NET

1047