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 are all the commands used with Data Adapter?
What is sqldatareader?
Is ADO.NET derived from COM? true /false
What is the use of SqlCommand object?
How is entity framework different from ado.net?
How can we perform transactions in .net?
How do we invoke queries from the application
Explain the namespaces in which .net has the data functionality class.
What are the differences between OLEDB and SQLClient Providers?
What is the provider and namespaces being used to access oracle database?
What are the major difference between classic ADO and ADO.NET?
What is an orm, and why would you use one instead of plain old ado.net?