图书馆管理系统程序的设计代码Word文档下载推荐.docx

上传人:b****3 文档编号:14708370 上传时间:2022-10-24 格式:DOCX 页数:14 大小:18.14KB
下载 相关 举报
图书馆管理系统程序的设计代码Word文档下载推荐.docx_第1页
第1页 / 共14页
图书馆管理系统程序的设计代码Word文档下载推荐.docx_第2页
第2页 / 共14页
图书馆管理系统程序的设计代码Word文档下载推荐.docx_第3页
第3页 / 共14页
图书馆管理系统程序的设计代码Word文档下载推荐.docx_第4页
第4页 / 共14页
图书馆管理系统程序的设计代码Word文档下载推荐.docx_第5页
第5页 / 共14页
点击查看更多>>
下载资源
资源描述

图书馆管理系统程序的设计代码Word文档下载推荐.docx

《图书馆管理系统程序的设计代码Word文档下载推荐.docx》由会员分享,可在线阅读,更多相关《图书馆管理系统程序的设计代码Word文档下载推荐.docx(14页珍藏版)》请在冰豆网上搜索。

图书馆管理系统程序的设计代码Word文档下载推荐.docx

if(radioManage.Checked==true)

{

stringstrcon="

DataSource=SIMON-VAIO;

InitialCatalog=lkl2;

IntegratedSecurity=True;

;

//连接数据库的字符串,用于指定数据库地址,名称,账号,密码,连接方式

SqlConnectionsqlCon=newSqlConnection(strcon);

//实例化并定义一个数据库连接

sqlCon.Open();

//打开数据库连接

stringsql="

select*fromloginwhereusernum=usernumanduserpassword=suerpassword"

//定义要查询sql语句

SqlCommandcmd=newSqlCommand(sql,sqlCon);

//实例化并定义sql语句和数据库路径

cmd.Parameters.Add("

usernum"

SqlDbType.NChar,20);

//定义cmd查询命令的字段属性,loginnamesqldbtypenchar(20)

suerpassword"

//同上

cmd.Parameters["

].Value=username.Text;

//将username中的text保存到变量loginname

].Value=password.Text;

SqlDataReaderdr=cmd.ExecuteReader();

if(dr.Read())

this.Visible=false;

Form2Formmain=newForm2();

//应该是实例化一个主窗体的

this.Hide();

//应该是切换到主窗口的或关闭自己的

Formmain.Show();

//应该是打开一个主窗体的

dr.Close();

//关闭dr的数据库连接

}

else//if(dr.Read())读取失败则执行如下代码

MessageBox.Show("

密码错误,请重新输入!

//显示提示信息

elseif(radioPerson.Checked==true)

stringsql1="

select*fromreaderwhereusernum=usernumanduserpassword=suerpassword"

SqlCommandcmd1=newSqlCommand(sql1,sqlCon);

cmd1.Parameters.Add("

cmd1.Parameters["

cmd1.CommandText=sql1;

SqlDataReaderdr=cmd1.ExecuteReader();

if(dr.Read())

Form9Formmain=newForm9();

else

MessageBox.Show("

用户名或密码错ª

误"

警告"

else

没有选择角色"

"

添加图书代码

SqlConnectionsqlcon=newSqlConnection("

stringstr="

insertintodbo.bookvalues(bnum,bname,bauthor,bpublic,bclasses,benshu)"

sqlcon.Open();

SqlCommandcmd=newSqlCommand(str,sqlcon);

bnum"

bname"

bauthor"

bpublic"

bclasses"

benshu"

SqlDbType.TinyInt);

].Value=bnum.Text;

].Value=bname.Text;

].Value=bauthor.Text;

].Value=bpublic.Text;

].Value=bclasses.Text;

].Value=benshu.Text;

cmd.ExecuteNonQuery();

sqlcon.Close();

this.bnum.Clear();

this.bname.Clear();

this.bauthor.Clear();

this.bpublic.Clear();

this.benshu.Clear();

this.bclasses.Clear();

添加成功!

删除图书代码

IntegratedSecurity=True"

deletefrombookwherebnum=bnum"

].Value=this.tnum.Text;

this.tnum.Clear();

this.tno.Clear();

this.tname.Clear();

this.tpublisher.Clear();

this.tauthor.Clear();

this.tclasses.Clear();

this.tbenshu.Clear();

删除成功!

查询图书代码

SqlConnectioncon=newSqlConnection();

//建立数据库连接

con.ConnectionString="

con.Open();

//打开连接

SqlCommandcmd=newSqlCommand("

select*frombookwherebname=bname"

con);

].Value=bookname.Text;

SqlDataAdapterda=newSqlDataAdapter(cmd);

DataTabledt=newDataTable("

图书记录表"

da.TableMappings.Add("

BorrowRecord"

借阅记录表"

da.TableMappings[0].ColumnMappings.Add("

图书号"

图书名"

作者"

类别"

本数"

da.Fill(dt);

dataGridView1.DataSource=dt;

con.Close();

图书更新代码

SqlConnectioncon1=newSqlConnection("

InitialCatalog=lk

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 农林牧渔 > 林学

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1