请教一C#使用存储过程的问题。
我想动态的在表中创建一列,如下
SqlCommand cmd1 = frmMain.Conn.CreateCommand();
cmd1.CommandType = System.Data.CommandType.StoredProcedure;
cmd1.CommandText = "li_sp_addcolume_studentInfo";
SqlParameter parInput = cmd.Parameters.Add("@pointInfo", SqlDbType.VarChar, 20);
parInput.Direction = ParameterDirection.Input;
parInput.Value = txtCourseName.Text;
cmd1.ExecuteNonQuery();
存储过程为:
ALTER PROCEDURE li_sp_addcolume_studentInfo
(
@pointInfo varchar (20)
)
AS
exec(
'ALTER TABLE tblStudentInfo ADD '+@pointInfo+' INT')
但是提示出错说存储过程未输入参数@pointInfo,是错在哪里呢了?大虾们帮忙看看,万分感谢