What are the steps in connecting to database ?
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / khalid
// Declare Namespace as ur Lang...
In c#
Using System.Data.SqlClient;
//connection
//If u provide uname & passwd to ur Database then this state //is true
SqlConnection con = new
SqlConnection("server=localhost;database=urDB_Name;uid=sa;pwd=;");
//else
SqlConnection con = new
SqlConnection("server=localhost;database=urDB_Name;");
con.Open();
if(con!=null)
msgbox("Connection sucessfully Done!");
else
msgbox("Sorry!Connection sucessfully is not Done!");
Is This Answer Correct ? | 0 Yes | 1 No |
What is meant by executenonquery?
Why is ADO.NET serialization slower than ADO ?
What is a sqldataadapter?
What are the three Ado objects?
6 Answers Microsoft, StarSoft,
What is the maximum pool size in ado.net connection string?
What is a datatable?
8 Answers State Bank Of India SBI,
What is datacolumn and how it is used?
What are the ado.net connection pooling parameters?
What are two important objects of ADO.Net?
What are the disadvantages of using datalist?
how to keep track of index in listbox items.
What is DataRowCollection?