private void Borrarbtn_Click(object sender, EventArgs e) { int IdCliente = GetIdFromName(IDCliente); SqlConnection oConnection = new SqlConnection(@"Server=localhost;Data Source=LAPTOP-RS890769\SQLEXPRESS;Database=AllSalesApp;Integrated Security=SSPI"); if (oConnection.State != System.Data.ConnectionState.Open) { oConnection.Open(); } SqlParameter paramID = new SqlParameter("@IdCliente", IdCliente); try { string sql = @" DELETE FROM[dbo].[tblCliente] WHERE IDCliente=@IdCliente"; SqlCommand oCommand = new SqlCommand(); oCommand.Connection = oConnection; oCommand.CommandType = System.Data.CommandType.Text; oCommand.CommandText = sql; oCommand.Parameters.Add(paramID); oCommand.ExecuteNonQuery(); MessageBox.Show("Proceso de Eliminacion Exitoso", "AllSalesApp", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); oConnection.Close(); ComboxManager.Manager(ref IDClientecombox, "SELECT [NombreCliente],[IDCliente] FROM[AllSalesApp].[dbo].[tblCliente]"); ClearTextBoxes(); } catch (Exception EX) { MessageBox.Show("Proceso de Eliminacion Fallido", "AllSalesApp", MessageBoxButtons.OK, MessageBoxIcon.Error); throw new Exception(EX.Message); } }
private void ConfigurarCliente_Load(object sender, EventArgs e) { ComboxManager.Manager(ref IDClientecombox, "SELECT [NombreCliente],[IDCliente] FROM[AllSalesApp].[dbo].[tblCliente]"); ComboxManager.Manager(ref ProvinciacomboBox, "SELECT [NombreProvincia],[IDProvincia] FROM[AllSalesApp].[dbo].[tblProvincia]"); }
private void CrearVendedor_Load(object sender, EventArgs e) { ComboxManager.Manager(ref ProvinciacomboBox, "SELECT [NombreProvincia],[IDProvincia] FROM[AllSalesApp].[dbo].[tblProvincia]"); ComboxManager.Manager(ref TiendaComboBox, "SELECT [NombreTienda],[IDTienda] FROM[AllSalesApp].[dbo].[tblTienda]"); }
private void BorrarCliente_Load_1(object sender, EventArgs e) { ComboxManager.Manager(ref IDClientecombox, "SELECT [NombreCliente],[IDCliente] FROM[AllSalesApp].[dbo].[tblCliente]"); }