Billing.cs
(开头部分) 7KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace BookShopTuto
{
public partial class Billing : Form
{
public Billing()
{
InitializeComponent();
Populate();
}
private void label8_Click(object sender, EventArgs e)
{
Application.Exit();
}
SqlConnection Con = new SqlConnection(@"Data Source=.;Initial Catalog=WhiteBookShopDb;Integrated Security=True;");
private void Populate()
{
try
{
Con.Open();
string query = "select * from BookTb1";
SqlDataAdapter sda = new SqlDataAdapter(query, Con);
SqlCommandBuilder builder = new SqlCommandBuilder(sda);
var ds = new DataSet();
sda.Fill(ds);
BookDGV.DataSource = ds.Tables[0];
Con.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void UpdateBook()
{
int newQty = stock - Convert.ToInt32(QtyTb.Text);
try
{
Con.Open();
string query = "update BookTb1 set BQty = " + newQty + " where BId = " + key + "";
SqlCommand cmd = new SqlCommand(query, Con);
cmd.ExecuteNonQuery();
MessageBox.Show("添加到购物车成功!!!");
Con.Close();
Populate();
Reset();
后面还有 138 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。