Code:
SqlParameter userParam = new SqlParameter("@Username", SqlDbType.VarChar);
userParam.Value = CreateUserWizard1.UserName;
SqlCommand cmd = new SqlCommand("usp_EmployeeUserNameInsert", conn);
cmd.CommandText = "usp_EmployeeUserNameInsert";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(userParam);
You'll be better off abstracting the data access code to its own library, maintaining code in event handlers becomes very hard work.
We use the Microsoft Patterns and Practices Enterprise Library for Data Access. It makes this sort of thing much cleaner and easier.
--
Joe (
Microsoft MVP - XML)