• 大小: 465.29 KB
    文件类型: .rar
    金币: 1
    下载: 1 次
    发布日期: 2024-12-08
  • 语言: C#
  • 标签: c#  sql2005  vs2005  

资源简介

本人课程设计,功能完善,界面美观。使用sql数据库,希望与大家相互学习多多交流。

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace 预演1
{
    public partial class frmAddBookInfo : Form
    {
        public frmAddBookInfo()
        {
            InitializeComponent();
        }

        private void btnAdd_Click(object sender EventArgs e)
        {
            if (txtIsbn.Text == ““ || txttitle.Text == ““)
                MessageBox.Show(“ISBN号和书名不能为空“ “提示“);
            else 
            {
                SqlConnection dbConnection = new SqlConnection(
                        @“Server = (local)\sqlexpress; Integrated Security = True;“
                            + “Database = bookSell“);
                dbConnection.Open();
                SqlCommand dbCommand = dbConnection.CreateCommand();
                dbCommand.CommandText = “select * from LibraryInfo where “
                                          + “ISBN =‘“ + txtIsbn.Text.Trim() + “‘“;
                if (dbCommand.ExecuteScalar() != null)
                {
                    dbConnection.Close();
                    MessageBox.Show(“该ISBN号已存在,添加失败“ “失败信息“);
                }
                else
                {
                    /*sql语句格式:insert into LibraryInfo (titleISBN...) values (titleValueisbnValue...) */
                    string sqlcmd = “insert into LibraryInfo “ 
                    + “(ISBNtitleWriterPublisherInDateInPriceSalePriceQtyOnhandComment) values (“;
                    sqlcmd += “‘“ + txtIsbn.Text.Trim() + “‘“;
                    sqlcmd += “‘“ + txttitle.Text.Trim() + “‘“;
                    sqlcmd += “‘“ + txtWriter.Text.Trim() + “‘“;
                    sqlcmd += “‘“ + txtPublisher.Text.Trim() + “‘“;
                    sqlcmd += “‘“ + datePicker.Text.Trim() + “‘ ‘“; 
                    sqlcmd += (txtInPrice.Text.Trim() != ““) ? txtInPrice.Text.Trim() : “0“;
                    sqlcmd += “‘ ‘“;
                    sqlcmd += (txtSalePrice.Text.Trim() != ““) ? txtSalePrice.Text.Trim() : “0“;
                    sqlcmd += “‘ ‘“;
                    sqlcmd += (txtQtyOnhand.Text.Trim() != ““) ? txtQtyOnhand.Text.Trim() : “0“;
                    sqlcmd += “‘“;
                    sqlcmd += “‘“ + txtComment.Text.Trim() + “‘)“;
                    dbCommand.CommandText = sqlcmd;
                    dbCommand.ExecuteNonQuery();
                    dbConnection.Close();
                    MessageBox.Show(“添加成功““提示“);
                }
            }
        }

        private void btnCancel_Click(object sender EventArgs e)
        {
            this.Close();
        }

        private void datePicker_ValueChanged(object sender EventArgs e)
        {

        }

        private void frmAddBookInfo_Load(object sender EventArgs e)
        {
            datePicker.Value = System.DateTime.Now;
    

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

     文件        944  2009-12-28 15:56  小型图书管理系统\小型图书销售系统.sln

    ..A..H.     50688  2010-01-06 15:46  小型图书管理系统\小型图书销售系统.suo

     文件        414  2009-12-26 13:51  小型图书管理系统\预演1\app.config

     文件       3092  2010-01-04 20:54  小型图书管理系统\预演1\frmAddBookInfo.cs

     文件      14296  2010-01-04 20:13  小型图书管理系统\预演1\frmAddBookInfo.Designer.cs

     文件       5814  2010-01-04 20:13  小型图书管理系统\预演1\frmAddBookInfo.resx

     文件       2197  2009-12-28 16:28  小型图书管理系统\预演1\frmAddUser.cs

     文件       6539  2009-12-28 16:28  小型图书管理系统\预演1\frmAddUser.Designer.cs

     文件       5814  2009-12-28 16:28  小型图书管理系统\预演1\frmAddUser.resx

     文件       1131  2009-12-28 16:32  小型图书管理系统\预演1\frmDelBookInfo.cs

     文件       3679  2009-12-28 16:32  小型图书管理系统\预演1\frmDelBookInfo.Designer.cs

     文件       5814  2009-12-28 16:32  小型图书管理系统\预演1\frmDelBookInfo.resx

     文件       1412  2009-12-28 16:28  小型图书管理系统\预演1\frmEditUser.cs

     文件       6514  2009-12-28 16:28  小型图书管理系统\预演1\frmEditUser.Designer.cs

     文件       5814  2009-12-28 16:28  小型图书管理系统\预演1\frmEditUser.resx

     文件       3571  2010-01-04 20:57  小型图书管理系统\预演1\frmLibraryManager.cs

     文件       7471  2010-01-04 20:33  小型图书管理系统\预演1\frmLibraryManager.Designer.cs

     文件       5814  2010-01-04 20:33  小型图书管理系统\预演1\frmLibraryManager.resx

     文件       1408  2010-01-04 20:53  小型图书管理系统\预演1\frmLibraryReport.cs

     文件       4123  2009-12-28 21:34  小型图书管理系统\预演1\frmLibraryReport.Designer.cs

     文件       5814  2009-12-28 21:34  小型图书管理系统\预演1\frmLibraryReport.resx

     文件       2377  2010-01-04 20:17  小型图书管理系统\预演1\frmModifyBookInfo.cs

     文件      14128  2010-01-04 20:17  小型图书管理系统\预演1\frmModifyBookInfo.Designer.cs

     文件       5814  2010-01-04 20:17  小型图书管理系统\预演1\frmModifyBookInfo.resx

     文件       4451  2010-01-04 21:28  小型图书管理系统\预演1\frmQuery.cs

     文件      18486  2010-01-04 21:28  小型图书管理系统\预演1\frmQuery.Designer.cs

     文件       5814  2010-01-04 21:28  小型图书管理系统\预演1\frmQuery.resx

     文件       8734  2010-01-05 18:00  小型图书管理系统\预演1\frmSale.cs

     文件      17948  2010-01-04 21:45  小型图书管理系统\预演1\frmSale.Designer.cs

     文件       5814  2010-01-04 21:45  小型图书管理系统\预演1\frmSale.resx

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

评论

共有 条评论