CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
不看会后悔的Windows XP之经验谈 简单快捷DIY实用家庭影院
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  .NET技术 >  C#

想了好久还是没办法解决,你有好的办法吗?

楼主flyingdream123()2006-05-03 17:40:35 在 .NET技术 / C# 提问

private   void   ComboBox_SelectedIndexChanged(object   sender,   EventArgs   e)  
                  {//更新记录  
                          //  
                          //DataRow[]   orw;  
                          //DataRow   dr;  
                          //if   (dsOperation.Operation.Rows.Count   >   1)  
                          //{  
                          //         orw   =   dsOperation.Operation.Select("IdGoodsData=\'"   +cmBox.SelectedValue.ToString().Trim()+"\'");  
                          //         dsOperation.Operation.Select("IdGoodsData   =   \'\'");  
                          //             operationDataGridView.CancelEdit();  
                          //         if   (orw   !=   null)  
                          //         {  
                          //                 dr   =   orw[0];  
                          //                 dr["Total"]   =   Convert.ToDecimal(dr["Total"])   +   1;  
                                         
                                           
                          //         }  
   
                          //         else  
                          //         {  
                                          kcDataSet4.GoodsDataRow   dr2   =   kcDataSet4.GoodsData.FindByIdGoodsData(cmBox.SelectedValue.ToString());  
                                          operationDataGridView.CurrentRow.Cells["dgTxUnit"].Value   =   dr2.Unit.ToString();  
                                          operationDataGridView.CurrentRow.Cells["dgTxUnitPrice"].Value   =   Convert.ToDecimal(dr2.UnitPrice.ToString());  
                                          operationDataGridView.CurrentRow.Cells["dgTxTotal"].Value   =   1;  
                                          operationDataGridView.CurrentRow.Cells["dgTxMoney"].Value   =   Convert.ToDecimal(dr2.Money.ToString());  
                                          operationDataGridView.CurrentRow.Cells["dgTxStandard"].Value   =   dr2.Standard.ToString();  
                                          if   (orderIDTextBox.Text   !=   "")  
                                                  operationDataGridView.CurrentRow.Cells["dgTxOrderID"].Value   =   orderIDTextBox.Text.Trim();  
                          //         }  
                          //}  
                          //else  
                          //{  
                          //           kcDataSet4.GoodsDataRow   dr2   =   kcDataSet4.GoodsData.FindByIdGoodsData(cmBox.SelectedValue.ToString());  
                          //                 operationDataGridView.CurrentRow.Cells["dgTxUnit"].Value   =   dr2.Unit.ToString();  
                          //                 operationDataGridView.CurrentRow.Cells["dgTxUnitPrice"].Value   =   Convert.ToDecimal(dr2.UnitPrice.ToString());  
                          //                 operationDataGridView.CurrentRow.Cells["dgTxTotal"].Value   =   1;  
                          //                 operationDataGridView.CurrentRow.Cells["dgTxMoney"].Value   =   Convert.ToDecimal(dr2.Money.ToString());  
                          //                 operationDataGridView.CurrentRow.Cells["dgTxStandard"].Value   =   dr2.Standard.ToString();  
                          //                 if   (orderIDTextBox.Text   !=   "")  
                          //                         operationDataGridView.CurrentRow.Cells["dgTxOrderID"].Value   =   orderIDTextBox.Text.Trim();  
                               
   
                          //}  
   
                  }  
   
                   
   
                  private   void   operationDataGridView_CellEndEdit(object   sender,   DataGridViewCellEventArgs   e)  
                  {  
                          if   (operationDataGridView.CurrentCell.ColumnIndex   ==   2   ||   operationDataGridView.CurrentCell.ColumnIndex   ==   3)  
                          {  
                                  if   (operationDataGridView.CurrentRow.Cells["dgTxUnitPrice"].Value.ToString()   !=   ""   &&   operationDataGridView.CurrentRow.Cells["dgTxTotal"].Value.ToString()   !=   "")  
                                  {  
                                          this.Validate();  
                                          this.operationBindingSource.EndEdit();  
                                          operationDataGridView.CurrentRow.Cells["dgTxMoney"].Value   =   Convert.ToDecimal(operationDataGridView.CurrentRow.Cells["dgTxUnitPrice"].Value)   *   Convert.ToDecimal(operationDataGridView.CurrentRow.Cells["dgTxTotal"].Value);  
                                  }  
                          }  
   
                  }  
  当添加一个产品时,如产品成在那么就把相应的产品数量+1,否则添加,现在是怎样实现加1?  
   
  问题点数:10、回复次数:2Top

1 楼yurow(路漫漫其修远兮,吾将上下而爬楼梯!)回复于 2006-05-05 00:14:38 得分 2

用存储过程很容易,还可以减少很多CS代码Top

2 楼san12655874(小三33)回复于 2006-05-05 00:19:23 得分 8

三层架构的思想不到位。  
  加重了前台的负荷  
   
  可以在SQL里面写存储过程就好了,或者把思路理清楚在重新写一遍Top

相关问题

关键词

得分解答快速导航

  • 帖主:flyingdream123
  • yurow
  • san12655874

相关链接

  • CSDN .NET频道
  • .NET类图书
  • C#类图书
  • .NET类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo