What are the steps in connecting to database ?
Answer Posted / kalirajan
// Declare Namespace as ur Lang...
In c#
Using System.Data.SqlClient;
//connection
SqlConnection con = new
SqlConnection("server=localhost;database=Grid_Db;uid=sa;pwd=;");
con.Open();
SqlCommand cmd = new SqlCommand("select * from Gtid_Tbl",con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
| Is This Answer Correct ? | 6 Yes | 1 No |
Post New Answer View All Answers
How to identify the controls which can be used for binding data?
Give an example of a .net application which connects to microsoft access database using ado.net classes.
What is data control techniques?
Which parameter of ConnectionString is used to specify the name of the database?
Explain how to call the sql commands asynchronously in ado.net version 2.0?
Explain why canot we use multiple inheritance and garbage collector paralelly in .net?
Which is faster sqldataadapter and sqldatareader?
What is difference between connected and disconnected architecture in ado.net?
How do you update a dataset in ado.net?
How to Read, Add, Update and Delete record in Entity Framework ?
Which object holds only data and does not interact with data source?
What does ado stand for in ado.net?
What is the maximum pool size in ado.net connection string?
What is sqlconnection and sqlcommand?
What is the difference between typed and untyped dataset?