I want to add data to a SQL database using a Stored Procedure. I know there is a way of running it via the DataSource object from the toolbox in VS 2008. I'm currently hard-coding it myself via the C# page (see attached code snippet).
I'm adding the User.Identity.Name to the DB, and this works fine. Can some one tell me how I can add the User.Identity.Name (or a String variable that represents User.Identity.Name) as a paramater via the SQL DataSource object from the toolbox. (See attached Screenshot).
I can get the original code to run by putting it in the Page_Load() method. If I use the datasource object in the ASPX page will the stored proc run automatically or will I need to call it somehow in the C# page?
public void Test()
SqlDataSource testDataSource = new SqlDataSource();
testDataSource.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString1"].ToString();
testDataSource.InsertCommandType = SqlDataSourceCommandType.StoredProcedure;
testDataSource.InsertCommand = "mpUserInsert";