数据库仓库管理系统课程设计

  1. 库存表—–Storage

create table Storage

(

Gno char (4) primary key,

Sno char (4) not null,

Gnum int not null check(Gnum=0),

foreign key (Sno ) references Storages(Sno),

foreign key (Gno) references Goods(Gno)

)

数据库仓库管理系统课程设计
  1. 入库信息—–表

Instoragecreate table Instorage(

Gno char (4) not null

Indate datetime primary key

Userno char (10) not null,

Addnum int not null,

Sno char (4) not null,

foreign key (Gno) references Goods(Gno),

foreign key (Sno ) references Storages(Sno),

foreign key(Userno) references Users(Userno)

)

数据库仓库管理系统课程设计
  1. 出库信息—–表Outstorage

create table Outstorage (

Gno char (4) not mull ,

Indate datetime primary key

Usemo char (10) not null,

Denum int not null,

Sno char (4) not null,

foreign key (Gno) references Goods(Gno),

foreign key (Sno ) references Storages(Sno)

foreign key(Userno) references Users(Userno)

)

数据库仓库管理系统课程设计
  1. 供应商Porvider

create table Provider(

Pno char (4) primary key,

Pname char (20) ,

Phone char (20)

数据库仓库管理系统课程设计

数据库链接与处理类;

public class DBhelper

{

public static string connSting =”Data Source= (1ocal) ;Database- WMS_ Project;User ID = 49; Pwd=123″

SqlConnection connection new SqlConnection (connSting) ;

public bool Userselectstring usersname, string password, string

IS)

{

string sqlJ String. Format(” select count(*) from Users where Username-‘ (0) and UserPassword=’ (1)’ and Usercon =’ (2);” usersname,password,IS);

Try

{

connection. 0pen();

SqlCommand command Hew SqlCommand (sql, connection) ;

int num in() command. ExecuteScalar0 ;

if (num ) 0)

{

return true;

}

Else

{

return false ;

}

}

Catch( Exception ex)

{

MessageBox. Show (ex. Message,”操作数据库出错”,MessageBoxButtons. OK MessageBoxIcon. Exclamation) ;

return false;

}

finally

{

connection, Close();

}

public bool SelectUserstring usersname, string password, string user)

{

string sql 8tring. Format(“select Username from Users where Username-‘ (0)’ and UserPassword-‘ (1)’ and Usercon .=” (2);” usersname, password) ;

try

{

connection. 0pen();

Sq1Command command Hew Sq1Command (sql, connection)

SqlDataReader reader command. ExecuteReader0;

while (reader. Read( ));

{

user=reader. GetString(0);

}

return true ;

catch (Exception ex)

{

MessageBox. Show(ex. Message,”操 作数据库出错”MessageBoxButtons. oK,MessageBoxIcon. Exclamation) ;

return false;

}

Finally

{

connection. Close();

}

}

public bool AddUser(string usno, string user sname, string password, string IS)

{

String sq1 = String. Format (” INSERT

Users (Userno, Username, UserPassword, Usercon)” + “VALUES(‘ (0)’,'(1)’,’ (2)’,’ (3)’)”,usno,

Try

{

connection. 0pen0();

SqlCommand command new SqlCommand (sql,

int num F int) command. ExecuteNonQuery( ;

if (num > 0)

MessageBox. Show(‘添加用户成功”,” 添加成功”,MessageBoxButtons. OK,MessageBoxIcon. Information) ;

return true;

}

else

{

MessageBox. Show(“添加用户失败”,”添 加失败”,MessageBoxButtons. OK, MessageBoxIcon. Information) :

return false;

}

}

catch (Exception ex)

{

MessageBox. Show (ex. Message,

}

MessageBoxIcon. Excl amation) ;return false;”操作数据库出错”,MessageBoxButtons. OK,

Return false;

}

Finally

{

Connect.Close();

}

}

public bool DeleteUser(string usno)

{

String sql 8tring. Format(“Delete From users Where Userno=’ (0)’ űsno);

try

{

connection. 0pen();

SqlCommand command new SqlCommand (sql, connection) ;

int num = int) command. ExecuteNonQuery :

if (num > 0)

{

MessageBox. Show(“HB HFiDhj”, ” H P 1l, Jh “, MessageBoxButtons. 0K,MessageBoxIcon. Information) ;

return true;

}

Else

{

MessageBox. Show(“HlHRHPkWx”, “HFRE k “, MessageBoxButtons. 0K,MessageBoxIcon. Information);

return false;

}

}

catch'( Exception ex)

MesageBox. Show(ex. Message,” 操作数据库出错”,MessageBoxButtons. OK,MessageBoxIcon. Exclamation) :

return false;

}

finally

{

connection. Close() ;

}

public bool ChangePWD(String Usno, string i Usname, string Uspassword,newpassword)

{

string sql – String. Format(“UPDATE users set UserPassword- (0 where Userno-‘ ()'”, newpassword, Usno);

string sqla String.Format(“select count(*) from Users where Userno-‘ (0)’ and Username’ (1)’ and UserPassword-” (2)’: Usno, Usname, Uspassword):

try

{

connection.0pen0;

SqlComand command new SqlCommand (sqla, connection) ;

int num =in0) command. ExecuteScalar0 ;

if (num > 0)

{

Sq1Command commands new SqlCotmand (sql, connection) ;

Try

{

MessageBox. Show(“修改密码成功 ” “修改密码成功”MessageBoxButtons. оK, MessageBoxIcon. Information);

return true;

}

catch

{

MessageBox. Show(“修改密码失败”,”修改密码失败”MessageBoxButtons. 0K, MessageBoxIcon. Information) ;

return false ;

}

}

else

{

MessageBox. Show(T密码验证失败”,”请确认密码用户名编号是否正确”,MessageBoxBut tons.0K, MessageBoxIcon. Information) ;

return false;

}

}

Catch (Exception ex)

{

MessageBox. Show(ex. Message,”操 作数据库出错”,MessageBoxButtons. OK,MessageBoxIcon. Exclamation) ;

return false;

}

Finally

{

connection。Close();

}

}

}

Original: https://blog.csdn.net/weixin_56107505/article/details/124751142
Author: 华仔882
Title: 数据库仓库管理系统课程设计

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/723559/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球