• 大小: 1.1MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-10-02
  • 语言: C#
  • 标签: c#  sql  server  

资源简介

基于c#和sql server2008的简单的汽车销售系统,实现基本客户管理,员工管理,订单管理功能

资源截图

代码片段和文件信息

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;
using System.Data.SqlClient;

namespace CarSales
{
    public partial class Car : Form
    {
        public Car()
        {
            InitializeComponent();
        }
        SqlConnection conn = new SqlConnection();
        SqlCommand com = new SqlCommand();
        private void Car_Load(object sender EventArgs e)
        {
            string mystr;
            mystr = “Data Source=.;Initial Catalog=CarSale;Integrated Security=True“;
            conn.ConnectionString = mystr;
            conn.Open();
            a();
        }
        public void a()
        {
            string sql = “select * from Car“;
            SqlDataAdapter myda = new SqlDataAdapter(sql conn);
            DataSet myds = new DataSet();
            myda.Fill(myds “Car“);
            dataGridView1.DataSource = myds.Tables[“Car“];
        }

        private void button4_Click(object sender EventArgs e)
        {
             string cnum model colour price camount pnum;
            cnum = textBox1.Text;
            model = textBox2.Text;
            colour = textBox3.Text;
            price = textBox4.Text;
            camount = textBox5.Text;
            pnum = textBox6.Text;
            com.Connection = conn;
            com.CommandText = “insert into Car values(@cnum@model@colour@price@camount@pnum)“;
            com.Parameters.Add(“@cnum“ SqlDbType.VarChar 10).Value = cnum;
            com.Parameters.Add(“@model“ SqlDbType.VarChar 10).Value = model;
            com.Parameters.Add(“@colour“ SqlDbType.VarChar 10).Value = colour;
            com.Parameters.Add(“@price“ SqlDbType.VarChar 10).Value = price;
            com.Parameters.Add(“@camount“ SqlDbType.VarChar 10).Value = camount;
            com.Parameters.Add(“@pnum“ SqlDbType.VarChar 10).Value = pnum;
            com.ExecuteNonQuery();
            a();


            try
            {
                string smodel = textBox2.Text;
                com.CommandText = “select smodel from Stock where smodel=@smodel“;
                com.Parameters.Add(“@smodel“ SqlDbType.VarChar 20).Value = smodel;
                if (smodel == com.ExecuteScalar().ToString())
                {
                    com.CommandText = “update Stock set samount=samount+‘“ + textBox5.Text + “‘“;
                    com.ExecuteNonQuery();
                }
            }

            catch
            {

                string smodels samount;
                smodels = textBox2.Text;
                samount = textBox5.Text;


                com.Connection = conn;
                com.CommandText = “insert into Stock values(@smodels@samount)“;
                com.Parameters.Add(“@smodels“ SqlDbType.NVarChar 20).Value = smodels;
                com.Paramete

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      69632  2018-05-30 22:18  CarSales\CarSales\bin\Debug\CarSales.exe

     文件     103936  2018-05-30 22:18  CarSales\CarSales\bin\Debug\CarSales.pdb

     文件      11608  2018-06-07 16:35  CarSales\CarSales\bin\Debug\CarSales.vshost.exe

     文件        490  2012-06-06 02:06  CarSales\CarSales\bin\Debug\CarSales.vshost.exe.manifest

     文件       3511  2016-07-09 12:08  CarSales\CarSales\Car.cs

     文件      11324  2016-07-06 12:17  CarSales\CarSales\Car.Designer.cs

     文件       6921  2016-07-06 12:17  CarSales\CarSales\Car.resx

     文件       5721  2016-07-04 15:44  CarSales\CarSales\CarSales.csproj

     文件       3341  2016-07-08 08:54  CarSales\CarSales\Consumer.cs

     文件      12254  2016-07-06 10:29  CarSales\CarSales\Consumer.Designer.cs

     文件       6737  2016-07-06 10:29  CarSales\CarSales\Consumer.resx

     文件       3466  2016-07-08 08:54  CarSales\CarSales\Employee.cs

     文件      12127  2016-07-06 11:26  CarSales\CarSales\Employee.Designer.cs

     文件       7289  2016-07-06 11:26  CarSales\CarSales\Employee.resx

     文件       1407  2016-07-04 17:07  CarSales\CarSales\Form1.cs

     文件       4204  2016-07-04 17:07  CarSales\CarSales\Form1.Designer.cs

     文件       5817  2016-07-04 17:07  CarSales\CarSales\Form1.resx

     文件       1686  2016-07-07 14:33  CarSales\CarSales\Main.cs

     文件       5852  2016-07-05 15:30  CarSales\CarSales\Main.Designer.cs

     文件      48080  2016-07-05 15:30  CarSales\CarSales\Main.resx

     文件        180  2018-05-30 22:18  CarSales\CarSales\obj\x86\Debug\CarSales.Car.resources

     文件        180  2018-05-30 22:18  CarSales\CarSales\obj\x86\Debug\CarSales.Consumer.resources

     文件       7379  2018-06-07 16:35  CarSales\CarSales\obj\x86\Debug\CarSales.csproj.FileListAbsolute.txt

     文件       1386  2016-09-27 18:59  CarSales\CarSales\obj\x86\Debug\CarSales.csproj.GenerateResource.Cache

     文件       1757  2016-09-27 18:59  CarSales\CarSales\obj\x86\Debug\CarSales.csprojResolveAssemblyReference.cache

     文件        180  2018-05-30 22:18  CarSales\CarSales\obj\x86\Debug\CarSales.Employee.resources

     文件      69632  2018-05-30 22:18  CarSales\CarSales\obj\x86\Debug\CarSales.exe

     文件        180  2018-05-30 22:18  CarSales\CarSales\obj\x86\Debug\CarSales.Form1.resources

     文件      28339  2018-05-30 22:18  CarSales\CarSales\obj\x86\Debug\CarSales.Main.resources

     文件     103936  2018-05-30 22:18  CarSales\CarSales\obj\x86\Debug\CarSales.pdb

............此处省略41个文件信息

评论

共有 条评论