📄 hysql.cs
字号:
using System;
using System.Data;
using System.Windows.Forms;
namespace bggl.cs
{
/// <summary>
/// hysql 的摘要说明。
/// </summary>
public class hysql
{
conn.conn con=new bggl.conn.conn();
DataSet objset;
public hysql()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
public DataSet selectexe()
{
string selectsql="select * from BG_HYB";
try
{
objset=con.selectexe(selectsql,"BG_HYB");
}
catch(Exception e)
{
MessageBox.Show(e.ToString());
}
return objset;
}
public DataSet selectexe(string id,string name)
{
string selectsql="";
if(id.Trim()!=""&&name.Trim()!="")
{
selectsql="select * from BG_HYB where hname='"+name+"' and hid="+id+"";
}
else
if(id.Trim()!="")
{
selectsql="select * from BG_HYB where hid="+id+"";
}
else
if(name.Trim()!=""){
selectsql="select * from BG_HYB where hname='"+name+"'";
}
try
{
objset=con.selectexe(selectsql,"BG_KF");
}
catch(Exception e)
{
MessageBox.Show(e.ToString());
}
return objset;
}
public bool insertexe(string hjb,string hname,string hxb,string hnian,string hdian,string hsfz,string hzk,string hblrq,string hzs)
{
string sqlins="insert into BG_HYB values('"+hjb+"','"+hname+"','"+hxb+"','"+hnian+"',"+hdian+",'"+hsfz+"','"+hzk+"','"+hblrq+"','"+hzs+"')";
try
{
return con.execomm(sqlins);
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
return false;
}
}
public bool updateexe(string id,string hjb,string hname,string hxb,string hnian,string hdian,string hsfz,string hzk,string hblrq,string hzs)
{
string upsql;
upsql="update BG_HYB set hjb='"+hjb+"',hname='"+hname+"',hxb='"+hxb+"',hnian="+hnian+",hdian='"+hdian+"',hsfz='"+hsfz+"',hzk='"+hzk+"',hblrq='"+hblrq+"',hzs='"+hzs+"' where hid='"+id+"'";
try
{
return con.execomm(upsql);
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
return false;
}
}
public bool delexe(string id)
{
string delsql="delete from BG_HYB where hid="+id+"";
try
{
return con.execomm(delsql);
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
return false;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -