Connect SQL Server to VS
HOW TO CONNECT SQL SERVER TO VISUAL STUDIO
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Anubhav ChaudharyPosted Feb 7, 2014, 6:04 AM
Using System.OleDb;
OleDbConnection x;
OleDbCommand y;
OleDbDataReader z;
private void Form1_Load(object sender, EventArgs e)
{
x = new OleDbConnection(@"provider=sqloledb;Data Source=LAB5\SQLEXPRESS;Initial Catalog=master;Integrated Security=SSPI;");
x.Open();
y = new OleDbCommand("select * from emp", x);
z = y.ExecuteReader();
while (z.Read())
{
MessageBox.Show(z["empno"].ToString() + " " +z["ename"].ToString());
}
x.Close();
}
Posted Feb 7, 2014, 4:10 AM