日期:2014-05-18 浏览次数:21114 次
create table tb_POLine ( POLineID int identity, POID int not null, GoodsID int not null, Qty int not null, LineDesc vchar(128) null, constraint PK_TB_POLINE primary key (POLineID) )
if (LineFlag == "Edit") { //根据ID查询明细记录 DTLine = GetDT(QryStr); //得到四列,与下面相同 } else { //给空DataTable添加四列,用于接受输入 DTLine.Columns.Add("POLineID", typeof(int)); DTLine.Columns.Add("GoodsID", typeof(int)); DTLine.Columns.Add("Qty", typeof(int)); DTLine.Columns.Add("LineDesc", typeof(string)); } this.gridLine.DataSource = DTLine;
//定义POID列 DataColumn poidcol = new DataColumn(); poidcol.ColumnName = "POID"; poidcol.DataType = typeof(int); poidcol.DefaultValue = GetPOID(); //根据单号得到其ID 添加POID列,并保存 DTLine.Columns.Add(poidcol); CSQL.UPdt(SaveLineStr, DTLine); //包含五列 //删除POID列,同步数据 DTLine.Columns.Remove(poidcol); DTLine.AcceptChanges();
exec sp_executesql N'INSERT INTO [tb_POLine] ([POID], [GoodsID], [Qty], [LineDesc]) VALUES (@p1, @p2, @p3, @p4)',N'@p1 int,@p2 int,@p3 int,@p4 varchar(8000)',@p1=12,@p2=5,@p3=6,@p4=NULL
exec sp_executesql N'UPDATE [tb_POLine] SET [Qty] = @p1 WHERE (([POLineID] = @p2) AND ([POID] = @p3) AND ([GoodsID] = @p4) AND ([Qty] = @p5) AND ((@p6 = 1 AND [LineDesc] IS NULL) OR ([LineDesc] = @p7)))',N'@p1 int,@p2 int,@p3 int,@p4 int,@p5 int,@p6 int,@p7 varchar(8000)',@p1=8,@p2=NULL,@p3=12,@p4=5,@p5=6,@p6=1,@p7=NULL