访问数据库的类
class MyMeans
{
public static int id = 0;
public static string Login_ID = "";
public static string Login_Name = "";
public static string Mean_SQL = "", Mean_Table = "", Mean_Field = "";
public static SQLiteConnection My_con;
public static string M_str_sqlcon = @"Data Source=sypfexam.db;Version=3";
public static int Login_n = 0;
public static string AllSql = "SELECT * from type";
public static int examid = 0;
public static int chuanpiaoid = 0;
public static int kaoshiorsuiji = 0;
Form3 frm3=new Form3();
Form6 frm6 = new Form6();
public static SQLiteConnection getcon()
{
My_con = new SQLiteConnection(M_str_sqlcon);
My_con.Open();
return My_con;
}
public void con_close()
{
if (My_con.State == ConnectionState.Open)
{
My_con.Close();
My_con.Dispose();
}
}
public SQLiteDataReader getcom(string SQLstr)
{
getcon();
SQLiteCommand My_com=My_con.CreateCommand();
My_com.CommandText=SQLstr;
SQLiteDataReader My_read=My_com.ExecuteReader();
return My_read;
}
public void getsqlcom(string SQLstr)
{
getcon();
SQLiteCommand SQLcom = new SQLiteCommand(SQLstr, My_con);
SQLcom.ExecuteNonQuery();
SQLcom.Dispose();
con_close();
}
public void typeexam()
{
if (examid <= 14000)
{
SQLiteDataReader reader = getcom("SELECT * from type where id=" + examid);
while (reader.Read())
{
frm3.Controls["label6"]