www.pudn.com > HotelManange2.rar > ClientManage.cs
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using HotelManange.DataFile;
namespace HotelManange.SqlFile
{
class ClientManage
{
private string selectStr;
private SqlConnection SqlConnection1;
private SqlCommand SqlCommand1=null;
// private SqlDataReader SqlDataReader1=null;
public ClientManage()
{
SqlConnection1 = new SqlConnection(HotelManange.DataFile.Connetion.ConString);
SqlCommand1 = new SqlCommand();
SqlCommand1.CommandType = CommandType.Text;
SqlCommand1.Connection = SqlConnection1;
}
public bool BookIn_Delete(string bID)
{
this.selectStr = "delete from BookIn_D where Book_N ='" + bID + "'";
this.SqlCommand1.CommandText = selectStr;
try
{
this.SqlConnection1.Open();
this.SqlCommand1.ExecuteNonQuery();
return true;
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
this.SqlConnection1.Close();
return false;
}
finally
{
this.SqlConnection1.Close();
}
}
public bool BookIn_Insert(string book_N, string name, string sex, string lType, string l_ID, string tel, string room_N, System.DateTime inDate, int days, string rem)
{
this.selectStr = "insert into BookIn_D(Book_N,Name,Sex,LType,L_ID,Tel,Room_N,InDate,Days,Rem) values('"+book_N+"','"+name+"','"+sex+"','"+lType+"','"+l_ID+"','"+tel+"','"+room_N+"','"+inDate+"','"+days+"','"+rem+"')";
this.SqlCommand1.CommandText = selectStr;
try
{
this.SqlConnection1.Open();
this.SqlCommand1.ExecuteNonQuery();
return true;
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
this.SqlConnection1.Close();
return false;
}
finally
{
this.SqlConnection1.Close();
}
}
//public bool BookIn_Modify()
}
}