public DataTable select(string sql, HAESQLiteVO vo) { DataTable dt = new DataTable(); try { conn.Open(); sqlCmd = conn.CreateCommand(); sqlCmd.CommandText = sql; string columnName = string.Empty; for (int idx = 0; idx < vo.size(); idx++) { columnName = vo.getKeys(idx); sqlCmd.Parameters.AddWithValue("@" + columnName, vo.get(columnName)); } SQLiteDataReader reader = sqlCmd.ExecuteReader(); dt.Load(reader); } catch { } finally { conn.Close(); } return(dt); }
public int executeQuery(string sql, HAESQLiteVO vo) { int exeCnt = 0; try { conn.Open(); sqlCmd = conn.CreateCommand(); sqlCmd.CommandText = sql; string columnName = string.Empty; for (int idx = 0; idx < vo.size(); idx++) { columnName = vo.getKeys(idx); sqlCmd.Parameters.AddWithValue("@" + columnName, vo.get(columnName)); } exeCnt = sqlCmd.ExecuteNonQuery(); } catch (Exception e) { } finally { conn.Close(); } return(exeCnt); }