ygsama / book-library-system Goto Github PK
View Code? Open in Web Editor NEW用C#(ADO.NET)实现的一个简单的图书管理系统
用C#(ADO.NET)实现的一个简单的图书管理系统
老哥能不能把sql文件发我邮箱一份,感谢感谢
严重性 代码 说明 项目 文件 行 禁止显示状态
错误 CS0234 命名空间“Microsoft.VisualBasic”中不存在类型或命名空间名“PowerPacks”(是否缺少程序集引用?) 图书管理系统 D:\C#Project\BooK-Library-System-master\图书管理系统\BorrowBooks.Designer.cs 345 活动的
错误 CS0234 命名空间“Microsoft.VisualBasic”中不存在类型或命名空间名“PowerPacks”(是否缺少程序集引用?) 图书管理系统 D:\C#Project\BooK-Library-System-master\图书管理系统\BorrowBooks.Designer.cs 344 活动的
错误 CS0234 命名空间“Microsoft.VisualBasic”中不存在类型或命名空间名“PowerPacks”(是否缺少程序集引用?) 图书管理系统 D:\C#Project\BooK-Library-System-master\图书管理系统\ReturnBooks.Designer.cs 392 活动的
错误 CS0234 命名空间“Microsoft.VisualBasic”中不存在类型或命名空间名“PowerPacks”(是否缺少程序集引用?) 图书管理系统 D:\C#Project\BooK-Library-System-master\图书管理系统\ReturnBooks.Designer.cs 393 活动的
错误 CS0234 命名空间“Microsoft.VisualBasic”中不存在类型或命名空间名“PowerPacks”(是否缺少程序集引用?) 图书管理系统 D:\C#Project\BooK-Library-System-master\图书管理系统\BorrowBooks.Designer.cs 54 活动的
错误 CS0234 命名空间“Microsoft.VisualBasic”中不存在类型或命名空间名“PowerPacks”(是否缺少程序集引用?) 图书管理系统 D:\C#Project\BooK-Library-System-master\图书管理系统\BorrowBooks.Designer.cs 55 活动的
错误 CS0234 命名空间“Microsoft.VisualBasic”中不存在类型或命名空间名“PowerPacks”(是否缺少程序集引用?) 图书管理系统 D:\C#Project\BooK-Library-System-master\图书管理系统\BorrowBooks.Designer.cs 273 活动的
警告 CS0108 '“ReturnBooks.Tag”隐藏继承的成员“Control.Tag”。如果是有意隐藏,请使用关键字 new。 图书管理系统 D:\C#Project\BooK-Library-System-master\图书管理系统\ReturnBooks.Designer.cs 402 活动的
警告 未能找到引用的组件“Microsoft.VisualBasic.PowerPacks.Vs”。 图书管理系统
警告 未能解析此引用。未能找到程序集“Microsoft.VisualBasic.PowerPacks.Vs, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL”。请检查磁盘上是否存在该程序集。 如果您的代码需要此引用,则可能出现编译错误。 图书管理系统
能上传一下数据库脚本吗,文件导入失败
①在borrowBooks中当先还书再借书的过程中容易产生ID冲突错误,简单修改如下:
//获取最大的编号
string sqlL = "SELECT MAX(ID) FROM borrow";
string maxID = SqlHelper.ExecuteScalar(sqlL).ToString();
if (maxID == "NULL" || maxID == "")
{
// 如果maxID为空或没有值,我们可以假设它为1,然后加1
maxID = "000001";
}
else {
int temp = int.Parse(maxID) + 1; // 确保先转换为整数,然后再加1
maxID = temp.ToString("D6"); // 更新maxID的值
}
// 插入数据到借书表(borrow)
sql = "insert into borrow values(@ID,@uId,@bName,@bNum,@bPrice,convert(varchar(20),GETDATE() ,111),convert(varchar(20),dateadd(day," + comboBox1.Text.ToString().Substring(0, 2) + ",CONVERT(varchar(20),GETDATE() ,111)),111),@Tag)";
MyDictionary dic = new MyDictionary();
dic.Add("@ID", maxID);
dic.Add("@uId", uIdTb.Text.Trim());
dic.Add("@bName", bNameTB.Text.Trim());
dic.Add("@bNum", bNumTB.Text.Trim());
dic.Add("@bPrice", bPriceTB.Text.Trim());
dic.Add("@Tag", "0");// Tag = 0 标记该书未超归还期限
int i = SqlHelper.ExecuteNonQuery(sql, dic);
if (i > 0)
{
n = (Convert.ToInt32(n) - 1).ToString(); // 库存量-1
sql = "update books set bTag=@bTag where bNum=@bNum";
MyDictionary dic2 = new MyDictionary();
dic2.Add("@bTag", n);
dic2.Add("@bNum", bNumTB.Text.Trim());
SqlHelper.ExecuteScalar(sql, dic2);
MessageBox.Show("提交成功");
}
②在InsertNewBook.cs中,注销书籍后新增书籍造成ID冲突错误,简单修改如下:
private void 新书入库Btn_Click(object sender, EventArgs e)
{
if (bNameTB.Text.Trim() == "" || bAuthorTB.Text.Trim() == "" || bPubComTB.Text.Trim() == "" || ISBN.Text.Trim() == "" || bTagTB.Text.Trim() == "" || bPriceTB.Text.Trim() == "" || bPubDatTB.Text.Trim() == "")
{
MessageBox.Show("请填写完整信息", "失败");
}
else
{
//获取最大的编号
string sqlL = "SELECT MAX(bNUM) FROM books";
string maxID = SqlHelper.ExecuteScalar(sqlL).ToString();
if (maxID == "NULL" || maxID == "")
{
// 如果maxID为空或没有值,我们可以假设它为1,然后加1
maxID = "000001";
}
else
{
int temp = int.Parse(maxID) + 1; // 确保先转换为整数,然后再加1
maxID = temp.ToString("D6"); // 更新maxID的值
}
// 自动获得图书序列号
string sql = " select COUNT(*)+1 from books";
string bNum = SqlHelper.ExecuteScalar(sql).ToString();
StringBuilder sb = new StringBuilder(bNum);
while (sb.Length != 6)
{
sb.Insert(0, "0");
}
bNum = sb.ToString();
// 添加操作
sql = "insert into books values(@bNum,@bName,@bAuthor,@bPubCom,@bPubDat,@ISBN,@bPrice,@bTag)";
MyDictionary dic = new MyDictionary();
dic.Add("@bNum", maxID);
dic.Add("@bName", bNameTB.Text.Trim());
dic.Add("@bAuthor", bAuthorTB.Text.Trim());
dic.Add("@bPubCom", bPubComTB.Text.Trim());
dic.Add("@bPubDat", bPubDatTB.Text.Trim());
dic.Add("@ISBN", ISBN.Text.Trim());
dic.Add("@bPrice", bPriceTB.Text.Trim());
dic.Add("@bTag", bTagTB.Text.Trim());
int i = SqlHelper.ExecuteNonQuery(sql, dic);
if (i == 1)
{
MessageBox.Show("添加成功,图书序列号为" + maxID);
}
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.