I\'m trying to create a seed DB in my web app, and i was able to create the DB, populate the tables, i\'m just stuck at getting the stored procedures to work. Here is what i
Instead of using 'USE [DataBase] Go' you can set or change the current database for an open SqlConnection very easily:
connection.ChangeDatabase("YourDB");
An example:
private static void ConctDatabase(string connectionString)
{
using (SqlConnection conn = new SqlConnection(connectionString))
{
conn.Open();
MessageBox.Show("Database: {0}", conn.Database);
conn.ChangeDatabase("Northwind");
MessageBox.Show("Database: {0}", conn.Database);
}
}