基本信息
源码名称:C# 家庭财务管理系统源码(入门级)
源码大小:0.50M
文件格式:.zip
开发语言:C#
更新时间:2018-06-11
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
附加数据库后 即可使用
附加数据库后 即可使用
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace 家庭财务管理系统
{
public partial class MainForm : Form
{
public MainForm()
{
InitializeComponent();
}
public static string id = "";
public static string kahao = "";
public static string shijian = "";
public static string jine = "";
public static string leixing = "";
private void label4_Click(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
string num = this.textBox1.Text;
string time = this.textBox2.Text;
string type = this.textBox4.Text;
if (num == "")
{
MessageBox.Show("银行卡号不能为空");
}
else
{
float money = float.Parse(this.textBox3.Text);
if (money < 0)
{
MessageBox.Show("交易金额必须大于0");
}
else
{
string sql = string.Format("insert into bankCard values('{0}','{1}','{2}','{3}')", num, time, money, type);
if (DBHelper.ExecuteNonQuery(sql))
{
MessageBox.Show("新增成功");
}
string sql1 = string.Format("select * from bankCard ");
DataTable dt = DBHelper.GetDataTable(sql1);
this.dataGridView1.DataSource = dt;
this.textBox1.Text = "";
this.textBox2.Text = "";
this.textBox3.Text = "";
this.textBox4.Text = "";
}
}
}
private void MainForm_Load(object sender, EventArgs e)
{
string sql = string.Format("select * from bankCard");
DataTable dt = DBHelper.GetDataTable(sql);
this.dataGridView1.DataSource = dt;
}
private void button2_Click(object sender, EventArgs e)
{
this.textBox1.Text = "";
this.textBox2.Text = "";
this.textBox3.Text = "";
this.textBox4.Text = "";
}
private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
id = this.dataGridView1.SelectedRows[0].Cells[0].Value.ToString();
kahao = this.dataGridView1.SelectedRows[0].Cells[1].Value.ToString();
shijian = this.dataGridView1.SelectedRows[0].Cells[2].Value.ToString();
jine = this.dataGridView1.SelectedRows[0].Cells[3].Value.ToString();
leixing = this.dataGridView1.SelectedRows[0].Cells[4].Value.ToString();
UpdateForm update = new UpdateForm();
update.Show();
}
private void button3_Click(object sender, EventArgs e)
{
string sql1 = string.Format("select * from bankCard ");
DataTable dt = DBHelper.GetDataTable(sql1);
this.dataGridView1.DataSource = dt;
}
}
}