public ActResult ExecuteNoneQueryOLEDB(string SQL) { ActResult _result = new ActResult(); SqlConnection sqlcon = LocalConnection(); SqlCommand command = new SqlCommand(); command.CommandText = SQL; command.CommandType = CommandType.Text; command.Connection = sqlcon; try { if (sqlcon.State != ConnectionState.Open) { sqlcon.Open(); } command.ExecuteNonQuery(); _result.Result = ActResult.ResultType.Success; } catch (Exception ex) { //Console.WriteLine("\r\n Error to Execute Command \r\n" + ex.Message); _result.Message = "\r\n Error to Execute Command \r\n" + ex.Message; _result.Result = ActResult.ResultType.Fail; } finally { sqlcon.Close(); } return(_result); }
public ActResult ExecuteTable(string SQL, SqlConnection sqlConn, SqlTransaction Trans, out DataTable dt) { ActResult actResult = new ActResult(); dt = new DataTable(); SqlCommand command = new SqlCommand(); command.CommandType = CommandType.Text; command.Connection = sqlConn; command.Transaction = Trans; command.CommandText = SQL; SqlDataAdapter adpter = new SqlDataAdapter(command); try { adpter.Fill(dt); actResult.Result = ActResult.ResultType.Success; } catch (Exception) { actResult.Result = ActResult.ResultType.Fail; } return(actResult); }
public DataTable Client_Freq(string sqlstring) { DataTable dtclientfre = new DataTable(); ActResult xresult = new ActResult(); SqlConnection conn = utili.ServerConnection(); conn.Open(); string sql = sqlstring; xresult = utili.ExecuteTable(sql, conn, null, out dtclientfre); if (xresult.Result == ActResult.ResultType.Success) { if (dtclientfre.Rows.Count > 0) { return dtclientfre; } else { return dtclientfre; } } return dtclientfre; }
public DataTable dbBranchResult(string sqlstring, SqlConnection sqlConn) { DataTable dtResult = new DataTable(); ActResult xresult = new ActResult(); string sql = sqlstring; xresult = ExecuteTable(sql, sqlConn, null, out dtResult); if (xresult.Result == ActResult.ResultType.Success) { if (dtResult.Rows.Count > 0) { return(dtResult); } else { return(dtResult); } } return(dtResult); }
public string dbSingleResult(string sqlstring) { DataTable dtResult = new DataTable(); ActResult xresult = new ActResult(); SqlConnection conn = ServerConnection(); string StrSql = ""; conn.Open(); string sql = sqlstring; xresult = ExecuteTable(sql, conn, null, out dtResult); if (xresult.Result == ActResult.ResultType.Success) { if (dtResult.Rows.Count > 0) { foreach (DataRow dr in dtResult.Rows) { StrSql = dr[0].ToString(); } } } return(StrSql); }
public DataTable dbResult(string sqlstring) { DataTable dtResult = new DataTable(); ActResult xresult = new ActResult(); SqlConnection conn = ServerConnection(); conn.Open(); string sql = sqlstring; xresult = ExecuteTable(sql, conn, null, out dtResult); if (xresult.Result == ActResult.ResultType.Success) { if (dtResult.Rows.Count > 0) { return(dtResult); } else { return(dtResult); } } return(dtResult); }
public DataTable CulumnTitleWO() { DataTable dtColumn = new DataTable(); ActResult xresult = new ActResult(); SqlConnection conn = utili.ServerConnection(); conn.Open(); string sql = "select * from Rep_ColumnTitle where ReportName='WO' and flag=1"; xresult = utili.ExecuteTable(sql, conn, null, out dtColumn); if (xresult.Result == ActResult.ResultType.Success) { if (dtColumn.Rows.Count > 0) { return(dtColumn); } else { return(dtColumn); } } return(dtColumn); }
public DataTable Write_Off(string sqlstring) { DataTable dtwriteoff = new DataTable(); ActResult xresult = new ActResult(); SqlConnection conn = utili.ServerConnection(); conn.Open(); string sql = sqlstring; xresult = utili.ExecuteTable(sql, conn, null, out dtwriteoff); if (xresult.Result == ActResult.ResultType.Success) { if (dtwriteoff.Rows.Count > 0) { return(dtwriteoff); } else { return(dtwriteoff); } } return(dtwriteoff); }
public DataTable PostBack_Date(string sqlstring) { DataTable dtbackdate = new DataTable(); ActResult xresult = new ActResult(); SqlConnection conn = utili.ServerConnection(); conn.Open(); string sql = sqlstring; xresult = utili.ExecuteTable(sql, conn, null, out dtbackdate); if (xresult.Result == ActResult.ResultType.Success) { if (dtbackdate.Rows.Count > 0) { return(dtbackdate); } else { return(dtbackdate); } } return(dtbackdate); }
public DataTable paidoff(string concat) { DataTable dtpaidoff = new DataTable(); ActResult xresult = new ActResult(); SqlConnection conn = utili.ServerConnection(); conn.Open(); string sql = @"select * from dbo.Rep_Client_PaidOff where reportdate='2019-04-30' and " + concat + " order by BrCode DESC"; xresult = utili.ExecuteTable(sql, conn, null, out dtpaidoff); if (xresult.Result == ActResult.ResultType.Success) { if (dtpaidoff.Rows.Count > 0) { return(dtpaidoff); } else { return(dtpaidoff); } } return(dtpaidoff); }