S
sun919
hi there... i ve a little question asking concerning saving data into
database
Basically, I have stored procedure name InsertquestionnaireList and the
argument for this is both correct
... I have a function which run this stored procedure.. All of these are
illustrated below, i dont know what i did wrong cause it should in theory
work fine sine i didnt have sp_name as the store procedure name
please help
many thanks
sun
FOR STORE PROCEDURE
ALTER PROCEDURE dbo.InsertQuestionnaireList
@HNID int, @register datetime, @TypeID int, @questionList int out
AS
SET NOCOUNT OFF;
insert into QuestionnaireList(HNID,questionnaireTypeID,
Register)
values (@HNID,@TypeID,@Register);
set @questionList = Scope_Identity();
FOR FUNCTION THAT RUN STORE PROCEDURE
sqlcmd.CommandText = "InsertQuestionnaireList";
sqlcmd.CommandType = System.Data.CommandType.StoredProcedure;
sqlcmd.Parameters.Add("@HNID", System.Data.SqlDbType.Int ).Value
= id ;
sqlcmd.Parameters.Add("@TypeID", System.Data.SqlDbType.Int).Value
= Convert.ToInt32(type);
sqlcmd.Parameters.Add("@register", System.Data.SqlDbType.DateTime)
Value = register ;
sqlcmd.Parameters.Add("@questionList", System.Data.SqlDbType.Int).
Value = 1;
sqlcmd.Parameters["@questionList"].Direction = System.Data.
ParameterDirection.Output;
con.Open();
sqlcmd.ExecuteNonQuery(); //error here when i execute this
thanks again in advance
database
Basically, I have stored procedure name InsertquestionnaireList and the
argument for this is both correct
... I have a function which run this stored procedure.. All of these are
illustrated below, i dont know what i did wrong cause it should in theory
work fine sine i didnt have sp_name as the store procedure name
please help
many thanks
sun
FOR STORE PROCEDURE
ALTER PROCEDURE dbo.InsertQuestionnaireList
@HNID int, @register datetime, @TypeID int, @questionList int out
AS
SET NOCOUNT OFF;
insert into QuestionnaireList(HNID,questionnaireTypeID,
Register)
values (@HNID,@TypeID,@Register);
set @questionList = Scope_Identity();
FOR FUNCTION THAT RUN STORE PROCEDURE
sqlcmd.CommandText = "InsertQuestionnaireList";
sqlcmd.CommandType = System.Data.CommandType.StoredProcedure;
sqlcmd.Parameters.Add("@HNID", System.Data.SqlDbType.Int ).Value
= id ;
sqlcmd.Parameters.Add("@TypeID", System.Data.SqlDbType.Int).Value
= Convert.ToInt32(type);
sqlcmd.Parameters.Add("@register", System.Data.SqlDbType.DateTime)
Value = register ;
sqlcmd.Parameters.Add("@questionList", System.Data.SqlDbType.Int).
Value = 1;
sqlcmd.Parameters["@questionList"].Direction = System.Data.
ParameterDirection.Output;
con.Open();
sqlcmd.ExecuteNonQuery(); //error here when i execute this
thanks again in advance