public DataSet delete(ClientEN cliente_borrado, int i) { string s; s = ConfigurationManager.ConnectionStrings["DefaultConnection"].ToString(); SqlConnection c = new SqlConnection(s); DataSet virtdb = new DataSet(); try { SqlDataAdapter da = new SqlDataAdapter("select * from Client", c); da.Fill(virtdb, "client"); DataTable t = new DataTable(); t = virtdb.Tables["client"]; t.Rows[i].Delete(); SqlCommandBuilder cbuilder = new SqlCommandBuilder(da); da.Update(virtdb, "client"); } catch (Exception ex) { ex.ToString(); Console.WriteLine("ERROR Deleting the client"); } finally { c.Close(); } return(virtdb); }
//Method used in order to obtain information about a client public DataSet read_Client(ClientEN cl) { ClientCAD c = new ClientCAD(); DataSet da = c.read(cl); return(da); }
//Method used in order to delete a cliente from the DB public DataSet delete_Client(ClientEN cl, int i) { ClientCAD c = new ClientCAD(); DataSet da = c.delete(cl, i); return(da); }
//Copy constructor public OrderEN(int orderId, ClientEN client, ProductEN product, DateTime date, String address, int postalCode) { this.orderId = orderId; this.client = client; this.product = product; this.date = date; this.address = address; this.postalCode = postalCode; }
public DataSet read(ClientEN cliente_leido) { string s; s = ConfigurationManager.ConnectionStrings["DefaultConnection"].ToString(); SqlConnection c = new SqlConnection(s); DataSet virtdb = new DataSet(); try { SqlDataAdapter da = new SqlDataAdapter("select * from Client", c); da.Fill(virtdb, "client"); } catch (Exception ex) { ex.ToString(); Console.WriteLine("ERROR showing the client"); } finally { c.Close(); } return(virtdb); }