0
How do i merge my c# program to a database?
4 Réponses
+ 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
0
Can you give more information. I don't understand you question. Do you want to connect to a database using c#?
0
I want to connect my c# program to my database. how do i go about it?
0
wow! thanks for this. will put it to test right away