0

How do i merge my c# program to a database?

11th Jun 2017, 10:01 PM
Guard Abasinkanga
Guard Abasinkanga - avatar
4 Answers
+ 1
Use a sqlconnection to connect to the database SqlConnection con = new SqlConnection(connectionString); Use a sqlcommand to query the database SqlCommand command1 = new SqlCommand("SELECT * FROM Employees", con); And a sqlDataReader to display the results SqlDataReader reader = command1.ExecuteReader() while (reader.Read()) { Console.WriteLine("{0} {1} {2}", reader.GetInt32(0), reader.GetString(1), reader.GetString(2)); } https://www.dotnetperls.com/sqlconnection
28th Jan 2018, 9:10 PM
sneeze
sneeze - avatar
0
Can you give more information. I don't understand you question. Do you want to connect to a database using c#?
12th Jun 2017, 3:57 PM
sneeze
sneeze - avatar
0
I want to connect my c# program to my database. how do i go about it?
28th Jan 2018, 11:45 AM
Guard Abasinkanga
Guard Abasinkanga - avatar
0
wow! thanks for this. will put it to test right away
23rd Feb 2018, 7:09 AM
Guard Abasinkanga
Guard Abasinkanga - avatar