public string PutOrdenCargaInfo(OrdenCargaInfo o) { try { DataTable table = new DataTable(); string query = @" update OrdenCargaInfo set IdOrdenCarga = " + o.IdOrdenCarga + ", SelloCaja = '" + o.SelloCaja + "', Campo1 = '" + o.Campo1 + "', Campo2 = '" + o.Campo2 + "', Campo3 = '" + o.Campo3 + "' where IdOrdenCargaInfo = " + o.IdOrdenCargaInfo + " " + @""; using (var con = new SqlConnection(ConfigurationManager.ConnectionStrings["Prolapp"].ConnectionString)) using (var cmd = new SqlCommand(query, con)) using (var da = new SqlDataAdapter(cmd)) { cmd.CommandType = CommandType.Text; da.Fill(table); } return("Se Actualizo Correctamente"); } catch (Exception exe) { return("Se produjo un error" + exe); } }
public string PostOrdenCargaInfo(OrdenCargaInfo o) { try { DataTable table = new DataTable(); string query = @" insert into OrdenCargaInfo (IdOrdenCarga, SelloCaja, Campo1, Campo2, Campo3) values (" + o.IdOrdenCarga + ", '" + o.SelloCaja + "', '" + o.Campo1 + "', '" + o.Campo2 + "', '" + o.Campo3 + "')" + @""; using (var con = new SqlConnection(ConfigurationManager.ConnectionStrings["Prolapp"].ConnectionString)) using (var cmd = new SqlCommand(query, con)) using (var da = new SqlDataAdapter(cmd)) { cmd.CommandType = CommandType.Text; da.Fill(table); } return("Se Agrego Correctamente"); } catch (Exception exe) { return("Se produjo un error" + exe); } }