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 provider ado.net use by default? Explain the role of data provider in ado.net?
What is ado and rdo?
What is oledb connection?
Describe datareader object of ado.net with example.
What is ado rdo dao in visual basic?
What is the role of the dataset object in ado.net?
Explain the difference between ado and ado.net?
How to add Primary key in DataSet
What is the difference between connected and disconnected environment?
What is acid in ado.net?
how to create a quiz software using 4 options to answer and how to check with answers in the database and award marks....
What is isolation?