📄 kfsql.cs
字号:
using System;
using System.Data;
using System.Windows.Forms;
namespace bggl.cs
{
/// <summary>
/// kfsql 的摘要说明。
/// </summary>
public class kfsql
{
conn.conn con=new bggl.conn.conn();
DataSet objset;
string zzz="";
public kfsql()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
public DataSet selectexeshu()
{
string selectsql="select * from BG_KF";
try
{
objset=con.selectexe(selectsql,"BG_KF");
}
catch(Exception e)
{
MessageBox.Show(e.ToString());
}
return objset;
}
public DataSet selectexet(string id)
{
string selectsql="select * from BG_KF where kid='"+id+"'";
try
{
objset=con.selectexe(selectsql,"BG_KF");
}
catch(Exception e)
{
MessageBox.Show(e.ToString());
}
return objset;
}
public bool insertexe(string id,string lou,string lx,string dh,string zs)
{
string sqlins="insert into BG_KF(kid,klc,kzt,klx,kdh,kzs) values("+id+","+lou+",'','"+lx+"','"+dh+"','"+zs+"')";
try
{
return con.execomm(sqlins);
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
return false;
}
}
public bool updateexe(string id,string lou,string lx,string dh,string zs)
{
string upsql;
upsql="update BG_KF set klc='"+lou+"',klx='"+lx+"',kdh='"+dh+"',kzs='"+zs+"' where kid='"+id+"'";
try
{
return con.execomm(upsql);
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
return false;
}
}
//用房间号获取房间类型
public string fjlx(string fjh){
string fjlx="";
objset=con.selectexe("select klx from BG_KF where kid='"+fjh+"' ","BG_KF");
foreach(DataRow dr in objset.Tables[0].Rows)
{
fjlx=dr["klx"].ToString().Trim();
}
return fjlx;
}
//开房用
public bool updateexek(string id,string kname,string kxin,string ksf,string krs,string kvipkh,string kzd,string kyj,string zk)
{
string upsql;
upsql="update BG_KF set kname='"+kname+"',kxin='"+kxin+"',ksf='"+ksf+"',krs='"+krs+"',kvipkh='"+kvipkh+"',kzd='"+kzd+"',kyj="+kyj+",krzsj='"+System.DateTime.Now.ToString()+"',kzt='2',kczy='"+gong.qjbl.name+"',kzk='"+zk+"' where kid='"+id+"'";
string delsql="delete from BG_YDB where yfj='"+id+"'";
try
{
bool z=true;
bool y=true;
z=con.execomm(upsql);
y=con.execomm(delsql);
if(z==true&&y==true)
{
return true;
}
else{
return false;
}
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
return false;
}
}
//删除房间类型时候判断房间里面是否引用了这个房间类型
public bool pdsf(string fjlx)
{
objset=con.selectexe("select * from BG_KF where klx='"+fjlx+"' ","BG_KF");
if(objset.Tables[0].Rows.Count==0)
{
return true;
}
else{
return false;
}
}
public string pdzt(string kid)
{
objset=con.selectexe("select * from BG_KF where kid='"+kid+"'","BG_KF");
foreach(DataRow dr in objset.Tables[0].Rows)
{
zzz=dr["kzt"].ToString().Trim();
}
return zzz;
}
public bool delexe(string kid)
{
string delsql="delete from BG_KF where kid="+kid+"";
try
{
return con.execomm(delsql);
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
return false;
}
}
public bool updateexey(string id,string ya)
{
string upsql;
upsql="update BG_KF set kyj="+ya+" where kid='"+id+"'";
try
{
return con.execomm(upsql);
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
return false;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -