I'm trying to find the best way to get a parameter into a stored procedure being called when a page loads up. My BindData code looks like this:
private void BindData()
SqlCommand cm = new SqlCommand("MyStoredProcedure");
cm.CommandType = CommandType.StoredProcedure;
cm.Parameters.Add(new SqlParameter("@UserID", Session["id"]));
MyGrid.DataSource = GetData(cm);
The userid is what I want to use as the parameter. It is a session variable I want to capture on login. Any idea the best way to do this? I'm using VS 2008/C#/SQL Server 2005.