This sample will teach you how to install MSDE and conect to msde via ADO.Net
Step 1 : Download MSDE. Click Here to download MSDE.
step 2: open Command prompt. go to the folder where MSDERelA folder resides (generally it will be in C:\MSDERelA).
Step 3: installing MSDE.
type setup SAPWD=[ur password] InstanceName=[InstanceName] SecurityMode=SQL
Step 4: for Getting into MSDE
type osql -E
Step 5: Create database and table
Step 6: Connecting to MSDE via ADO.Net
SqlConnection conn = new SqlConnection();
conn.ConnectionString = "Server=.;uid=sa;database=Books";
conn.Open();
SqlCommand comm = new SqlCommand("select * from MyTable", conn);
SqlDataReader dr = comm.ExecuteReader(CommandBehavior.CloseConnection);
if (dr.Read())
{
textBox1.Text = dr["Name"].ToString();
textBox2.Text = dr["Age"].ToString();
}
No comments:
Post a Comment