I need to open a pre-existing Database in ASP.NET Web Form with C#. So far all I have managed to find, are tutorial's on how to make a new Database and Table's.
If anyone know's how to do this please let me know.
Thanks'
Open a connection to the database. You will need the proper connection string. The place to go is ConnectionStrings.com .
SqlConnection conn = new SqlConnection(yourConnectionString);
Create a command
string yourSQL = "SELECT FirstName FROM Employees";
SqlCommand cmd = new SqlCommand(yourSQL, conn);
Do something with it..
That's the basic pattern.
Add a connection string to web.config and then Write the connection code.
The following is a good place to start for the conn string and the code: https://www.connectionstrings.com/sql-server-2012/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.