i assume you have already watched the previous tutorial
if you havent then check this out
http://icytrey.blogspot.com/2015/01/c-easiest-way-to-connect-to-local.html
and can connect to your local database without any problems
just copy and paste its not a crime
System.Data.SqlClient.SqlConnection con;
con = new System.Data.SqlClient.SqlConnection();
con.ConnectionString = @"Data Source=(LocalDB)\v11.0;
AttachDbFilename=C:\Users\icytrey\documents\visual studio 2013\Projects\PdfToWordDocument\PdfToWordDocument\MysimpleDatabase.mdf;
Integrated Security=True;
Connect Timeout=30;";
con.Open();
SqlCommand command = new SqlCommand("select * from Movies", con);
SqlDataReader reader = command.ExecuteReader();
while (reader.Read())
{
int Id = reader.GetInt32(0);
String name = reader.GetString(1);
String categoruy= reader.GetString(2);
listBox1.Items.Add(name);
}
con.Close();
Many thanks for your post.
ReplyDeleteapple service center chennai | ipod service center in chennai | apple iphone service center in chennai | apple service center chennai
NBA Picks and Predictions 2021 - Thakasino.com happyluke happyluke dafabet dafabet 962Playtech Slot Games - Best Casino Sites for Slot Gamblers
ReplyDelete