using System.Data.SQLite; // 추가 |
using System.Data.SQLite; // 추가
string gsFilePath = System.IO.Directory.GetCurrentDirectory();
// 현재 디렉토리 가져오기 위함 |
string gsFilePath = System.IO.Directory.GetCurrentDirectory();
// 현재 디렉토리 가져오기 위함
// select sample
string Conn = gsFilePath + "/Test.db";
String dbConnection = String.Format("Data Source={0}", Conn);
SQLiteConnection dbcon = new SQLiteConnection(dbConnection);
dbcon.Open();
SQLiteCommand qry = new SQLiteCommand("SELECT * FROM Test order by seq desc limit 1", dbcon);
DataTable dattbl = new DataTable();
SQLiteDataReader reader = qry.ExecuteReader();
dattbl.Load(reader);
reader.Close();
if (dattbl.Rows.Count > 0)
{
string Temp1= dattbl.Rows[0][0].ToString();
int Temp2= int.Parse(dattbl.Rows[0][1].ToString());
string Temp3= dattbl.Rows[0][2].ToString();
string Temp4= dattbl.Rows[0][3].ToString();
intTemp5= int.Parse(dattbl.Rows[0][4].ToString());
} |
// select sample
string Conn = gsFilePath + "/Test.db";
String dbConnection = String.Format("Data Source={0}", Conn);
SQLiteConnection dbcon = new SQLiteConnection(dbConnection);
dbcon.Open();
SQLiteCommand qry = new SQLiteCommand("SELECT * FROM Test order by seq desc limit 1", dbcon);
DataTable dattbl = new DataTable();
SQLiteDataReader reader = qry.ExecuteReader();
dattbl.Load(reader);
reader.Close();
if (dattbl.Rows.Count > 0)
{
string Temp1= dattbl.Rows[0][0].ToString();
int Temp2= int.Parse(dattbl.Rows[0][1].ToString());
string Temp3= dattbl.Rows[0][2].ToString();
string Temp4= dattbl.Rows[0][3].ToString();
intTemp5= int.Parse(dattbl.Rows[0][4].ToString());
}
// insert sample
string tempQry = string.Empty;
try
{
string Conn = gsFilePath + "/Test2.db";
String dbConnection = String.Format("Data Source={0}", Conn);
SQLiteConnection dbcon = new SQLiteConnection(dbConnection);
dbcon.Open();
SQLiteCommand qry = new SQLiteCommand(" insert into WIRE (pt_no, SEQ, Wire_Code
,Wire_nm, Wire_gram ) values(" + temA + ptno + temAE +
temA + seq + temAE +
temA + Wire_Code + temAE +
temA + Wire_nm + temAE +
temA + Wire_gram + temA +
")", dbcon);
qry.ExecuteNonQuery();
dbcon.Close();
}
catch (Exception)
{
throw;
}
} |
// insert sample
string tempQry = string.Empty;
try
{
string Conn = gsFilePath + "/Test2.db";
String dbConnection = String.Format("Data Source={0}", Conn);
SQLiteConnection dbcon = new SQLiteConnection(dbConnection);
dbcon.Open();
SQLiteCommand qry = new SQLiteCommand(" insert into WIRE (pt_no, SEQ, Wire_Code
,Wire_nm, Wire_gram ) values(" + temA + ptno + temAE +
temA + seq + temAE +
temA + Wire_Code + temAE +
temA + Wire_nm + temAE +
temA + Wire_gram + temA +
")", dbcon);
qry.ExecuteNonQuery();
dbcon.Close();
}
catch (Exception)
{
throw;
}
}
// insert sample
string tempQry = string.Empty;
string Conn = gsFilePath + "/TEST2.db";
String dbConnection = String.Format("Data Source={0}", Conn);
SQLiteConnection dbcon = new SQLiteConnection(dbConnection);
dbcon.Open();
SQLiteCommand qry = new SQLiteCommand("delete from Table ", dbcon);
qry.ExecuteNonQuery();
dbcon.Close(); |
// insert sample
string tempQry = string.Empty;
string Conn = gsFilePath + "/TEST2.db";
String dbConnection = String.Format("Data Source={0}", Conn);
SQLiteConnection dbcon = new SQLiteConnection(dbConnection);
dbcon.Open();
SQLiteCommand qry = new SQLiteCommand("delete from Table ", dbcon);
qry.ExecuteNonQuery();
dbcon.Close();