Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static class DatabaseUsage
- {
- //TODO
- //Create stored procedure (watch video online)
- //Stored the connection string in the object myConnection (it is static so it can be used by the static methods here)
- private SqlConnection myConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["myDbConnection"].ToString());
- //This is used to store the sql among the different methods
- private static SqlCommand myCommand = new SqlCommand();
- //Used to read data from the sql statements
- private static SqlDataReader myReader;
- //Opens a connection to the database
- public static void openDatabaseConnection()
- {
- myCommand.Connection = myConnection; //Scince the connection has to be opened before any methods can be run on the database, this will always be declared at the start
- myConnection.Open();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement