tellermanagement.cs
来自「本论文叙述了联机考试系统的现状以及C#语言的概况。重点介绍了联机考试系统的实现过」· CS 代码 · 共 45 行
CS
45 行
using System;
using System.Data;
using System.Data.OleDb;
namespace SupermarketProject
{
/// <summary>
/// Summary description for TellerManagement.
/// </summary>
public class TellerManagement
{
public TellerManagement()
{
}
public void SaveBill(DataSet ds)
{
string str;
int count= ds.Tables[0].Rows.Count;
DataTable dtBill = ds.Tables[0];
DataRow drBill = dtBill.Rows[count-1]; //get the last added row in the dataset
//add the content of that row into Bills table
str = "Insert into Bills (BillNo, Billdate, Usrid, TotalBillAmt,PaymentMode) values ("+drBill["BillNo"]+",#"+drBill["BillDate"]+"#,'"+drBill["UsrId"]+"',"+drBill["TotalBillAmt"]+",'"+drBill["PaymentMode"]+"')";
Console.WriteLine (str);
DataConnection.commnd.CommandText = str;
DataConnection.commnd.ExecuteNonQuery ();
//add into BillDetails table
DataTable dtBillDet = ds.Tables[1];
foreach(DataRow drBillDet in dtBillDet.Rows)
{
str="Insert into Billdetails values ("+drBillDet["BillNo"]+","+drBillDet["StockId"]+",'"+drBillDet["Quantity"]+"',"+drBillDet["SalePrice"]+")";
Console.WriteLine (str);
DataConnection.commnd.CommandText = str;
if (DataConnection.commnd.ExecuteNonQuery ()>0)
Console.WriteLine ("已添加");
}
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?