返回首页

大家好,

我有一个存储过程,需要几个参数,我的目标是将这些值插入表中。我的表有一个自动递增字段{身份(1,1)},我试图插入数据,因为没有这样的列,因为在互联网上有一些这样的例子。虽然没有错误,并尝试catch块不捕获任何成功的方案整理后,数据不会被插入。为什么??帮助,请

这里是我的表:

mytable([productcode] [varchar](100) NULL,

	[productid] [varchar](30) NULL,

	[mydate] [smalldatetime] NULL,

	[Id] [int] IDENTITY(1,1) NOT NULL

)

这里是我的SP:

这里是我的代码:

#region Database

Database db = DatabaseFactory.CreateDatabase("sample.Properties.Settings.mydbConnectionString");

DbCommand cmd = db.GetStoredProcCommand("mysp");

db.AddInParameter(cmd, "@procode", DbType.String, pcode);

db.AddInParameter(cmd, "@pid", DbType.String, pid);

db.AddInParameter(cmd, "@mydate", DbType.DateTime, dt);

#endregion

try{  

   db.ExecuteDataSet(cmd);

}

catch (Exception ex){

   Console.WriteLine(ex.Message);

}

     

预先感谢

回答

评论会员: 时间:2
N