public override int DoCommand(string sql, DbParam[] dp) { OleDbCommand od = new OleDbCommand(sql, oc); od.Transaction = ot; if (dp != null) { for (int i = 0; i < dp.Length; i++) { if (dp[i] != null) { od.Parameters.Add(dp[i].Name, DbParam.GetOleDbType(dp[i].Type), dp[i].Size).Value = dp[i].Value; } } } int rst = -1; if (od.Connection.State == ConnectionState.Open) { rst = od.ExecuteNonQuery(); } else { od.Connection.Open(); try { rst = od.ExecuteNonQuery(); } finally { od.Connection.Close(); } } return(rst); }
public override DataSet GetDataSet(string sql, DbParam[] dp, int startRecord, int maxRecords) { OleDbCommand od = new OleDbCommand(sql, oc); od.Transaction = ot; if (dp != null) { for (int i = 0; i < dp.Length; i++) { if (dp[i] != null) { od.Parameters.Add(dp[i].Name, DbParam.GetOleDbType(dp[i].Type), dp[i].Size).Value = dp[i].Value; } } } OleDbDataAdapter da = new OleDbDataAdapter(od); DataSet ds = new DataSet(); da.Fill(ds, startRecord, maxRecords, "Table0"); return(ds); }