public void Execute_Query(string com_str, int connId) { WorkerResult = new SqlWorkerQueryResult(com_str); WorkerResult.Start(); try { com = GetConnection(connId).CreateCommand(); com.CommandText = com_str; int cnt = com.ExecuteNonQuery(); WorkerResult.Success(cnt); } catch (Exception ex) { WorkerResult.Error(ex.Message); } WorkerResult.End(); }
public DataTable Execute_DataTable(string com_str, int connId) { WorkerResult = new SqlWorkerQueryResult(com_str); WorkerResult.Start(); try { da = new SQLiteDataAdapter(com_str, GetConnection(connId)); tbl = new DataTable(); da.Fill(tbl); int cnt = tbl != null ? tbl.Rows.Count : 0; WorkerResult.Success(cnt); } catch (Exception ex) { WorkerResult.Error(ex.Message); } WorkerResult.End(); return(tbl); }
public SQLiteDataReader Execute_DataReader(string com_str, int connId) { WorkerResult = new SqlWorkerQueryResult(com_str); WorkerResult.Start(); try { com = GetConnection(connId).CreateCommand(); com.CommandText = com_str; dr = com.ExecuteReader(); int cnt = 0; WorkerResult.Success(cnt); } catch (Exception ex) { WorkerResult.Error(ex.Message); } WorkerResult.End(); return(dr); }
public void Execute_Query(string com_str, int connId, SQLiteParameter[] prm) { WorkerResult = new SqlWorkerQueryResult(com_str); WorkerResult.Start(); try { com = GetConnection(connId).CreateCommand(); com.CommandText = com_str; for (int i = 0; i < prm.Length; i++) { com.Parameters.Add(prm[i]); } int cnt = com.ExecuteNonQuery(); WorkerResult.Success(cnt); } catch (Exception ex) { WorkerResult.Error(ex.Message); } WorkerResult.End(); }