日期:2014-05-18  浏览次数:20577 次

翻书翻了1小时,还是想不出来了,凌晨1点了吃不消了,关于output问题,看代码的。。。
首先我发下我的存储过程:
create proc InsertTbl
@insertTime datetime,
@updateTime datetime,
@question1 varchar(10),
@question2 varchar(10),
@question3 varchar(50),
@question3and1 varchar(200),
@question4 varchar(50),
@question4and1 varchar(200),
@question5 varchar(50),
@question5and1 varchar(200),
@question6 varchar(10),
@question7 varchar(10),
@question8 varchar(10),
@question9 varchar(10),
@question10 varchar(10),
@question11 varchar(10),
@question12 varchar(10),
@question13 varchar(50),
@question13and1 varchar(200),
@question14 varchar(50),
@question14and1 varchar(200),
@question15 varchar(10),
@question15and1 varchar(200),
@question16 varchar(50),
@question16and1 varchar(200),
@question17 varchar(50),
@question17and1 varchar(200),
@question18 varchar(10),
@question19 varchar(10),
@question20 varchar(40),
@question20and1 varchar(200),
@question21 varchar(10),
@question22 varchar(40),
@question23 varchar(40),
@question24 varchar(10),
@question25 varchar(200),
@id int output
as
insert into tblQuestion(insertTime,updateTime,question1,question2,question3,question3and1,question4,question4and1,question5,question5and1,question6,question7,question8,question9,question10,question11,question12,question13,question13and1,question14,question14and1,question15,question15and1,question16,question16and1,question17,question17and1,question18,question19,question20,question20and1,question21,question22,question23,question24,question25)
values(getdate(),getdate(),@question1,@question2,@question3,@question3and1,@question4,@question4and1,@question5,@question5and1,@question6,@question7,@question8,@question9,@question10,@question11,@question12,@question13,@question13and1,@question14,@question14and1,@question15,@question15and1,@question16,@question16and1,@question17,@question17and1,@question18,@question19,@question20,@question20and1,@question21,@question22,@question23,@question24,@question25)
set @id=@@identity
return 1

然后我发下我的CLICK事件的后台代码:
//如何取值我就不发了,都是FOREACH遍历一些的结果

SqlConnection cn = new SqlConnection(@"server=.\sqlexpress;uid=sa;pwd=;database=test");
  SqlCommand cmd = new SqlCommand("InsertTbl", cn);
  cmd.CommandType = CommandType.StoredProcedure;
  cmd.Parameters.Add("@question1", SqlDbType.VarChar).Value = Question1;
  cmd.Parameters.Add("@question2", SqlDbType.VarChar).Value = Question2;
  cmd.Parameters.Add("@question3", SqlDbType.VarChar).Value = Question3;
  cmd.Parameters.Add("@question3and1", SqlDbType.VarChar).Value = Question3and1;
  cmd.Parameters.Add("@question4", SqlDbType.VarChar).Value = Question4;
  cmd.Parameters.Add("@question4and1", SqlDbType.VarChar).Value = Question4and1;
  cmd.Parameters.Add("@question5", SqlDbType.VarChar).Value = Question5;
  cmd.Parameters.Add("@question5and1", SqlDbType.VarChar).Value = Question5and1;
  cmd.Parameters.Add("@question6", SqlDbType.VarChar).Value = Question6;
  cmd.Parameters.Add("@question7", SqlDbType.VarChar).Value = Question7;
  cmd.Parameters.Add("@question8", SqlDbType.VarChar).Value = Question8;
  cmd.Parameters.Add("@question9", SqlDbType.VarChar).Value = Question9;
  cmd.Parameters.Add("@question10", SqlDbType.VarChar).Value = Question10;
  cmd.Parameters.Add("@question11", SqlDbType.VarChar).Value = Question11;
  cmd.Parameters.Add("@question12", SqlDbType.V