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
how Sequence to connect and retrieve data from database using dataset?
How can you identify whether or not any changes are made to the DataSet object since it was last loaded?
Does dapper use ado.net?
Which object holds only data and does not interact with data source?
Can datareader hold data from multiple tables?
Define executenonquery?
Explain the two fundamental objects in ado.net?
What are the types of databinding?
What are the different layers of ado.net?
Can we create Synonymns in MS Acess,My Sql Server,Sql Server? But iam we can create in oracle!
Explain the difference in an abstract class and an interface?
How can I retrieve two tables of data at a time by using data reader?
How to find the given query is optimised one or not?
What is the difference between typed and untyped dataset?
Explain what are the steps to connect to a database?