Este documento describe el desarrollo de un sistema de gestión de negocios llamado Shine System utilizando C#. Incluye varias interfaces de usuario con controles como cuadros de diálogo, botones y cuadros de texto. Explica cómo se conecta a una base de datos SQL Server para realizar operaciones CRUD en tablas como clientes, proveedores y productos.
El objetivo de esta práctica es aplicar de forma integral los aspectos básicos de flash en una aplicación web, realizada totalmente en flash(ActionScript), que permite clasificar y acceder a una serie de prácticas resueltas relacionadas con materias informáticas. En esta práctica se utilizan componentes (Accordion, Button, ProgressBar, RadioButton, ScrollPane, Tree, MediaDisplay, MediaController, Window,…), loadMovie, #include (.as), import (class), clips de película, audio y video, capas máscara y guía, etc.
Aprenda a conectar sql y c# en 19 sencillos pasos!Ziscko
Sencillo tutorial que explica una manera de conectar una base de datos hecha en MS SQL Server 2005 dentro de una aplicación creada en visual c# 2008.
Visiten ziscko.wordpress.com
Fundamentos de Programación Visual Basic 2010Luis Ruiz Ch
Resolución de casos propuestos facilitados por el Ing. Victor Dávila y Desarrollados por el grupo de alumnos de la Universidad Privada del Norte del curso "Desarrolo de Sistemas y Bases de datos" conformado por Dávila Diego, Paredes Bryan, Perez Fiorella, Ruiz Luis y Sánchez Jhon.
El objetivo de esta práctica es aplicar de forma integral los aspectos básicos de flash en una aplicación web, realizada totalmente en flash(ActionScript), que permite clasificar y acceder a una serie de prácticas resueltas relacionadas con materias informáticas. En esta práctica se utilizan componentes (Accordion, Button, ProgressBar, RadioButton, ScrollPane, Tree, MediaDisplay, MediaController, Window,…), loadMovie, #include (.as), import (class), clips de película, audio y video, capas máscara y guía, etc.
Aprenda a conectar sql y c# en 19 sencillos pasos!Ziscko
Sencillo tutorial que explica una manera de conectar una base de datos hecha en MS SQL Server 2005 dentro de una aplicación creada en visual c# 2008.
Visiten ziscko.wordpress.com
Fundamentos de Programación Visual Basic 2010Luis Ruiz Ch
Resolución de casos propuestos facilitados por el Ing. Victor Dávila y Desarrollados por el grupo de alumnos de la Universidad Privada del Norte del curso "Desarrolo de Sistemas y Bases de datos" conformado por Dávila Diego, Paredes Bryan, Perez Fiorella, Ruiz Luis y Sánchez Jhon.
Utilizando el software Visual Studio y el lenguaje de programación C#, se realizo una actividad de crear un correo mediante el uso de windows forms, cabe aclarar que no se empleo ninguna base de datos.
(PROYECTO) Límites entre el Arte, los Medios de Comunicación y la Informáticavazquezgarciajesusma
En este proyecto de investigación nos adentraremos en el fascinante mundo de la intersección entre el arte y los medios de comunicación en el campo de la informática.
La rápida evolución de la tecnología ha llevado a una fusión cada vez más estrecha entre el arte y los medios digitales, generando nuevas formas de expresión y comunicación.
Continuando con el desarrollo de nuestro proyecto haremos uso del método inductivo porque organizamos nuestra investigación a la particular a lo general. El diseño metodológico del trabajo es no experimental y transversal ya que no existe manipulación deliberada de las variables ni de la situación, si no que se observa los fundamental y como se dan en su contestó natural para después analizarlos.
El diseño es transversal porque los datos se recolectan en un solo momento y su propósito es describir variables y analizar su interrelación, solo se desea saber la incidencia y el valor de uno o más variables, el diseño será descriptivo porque se requiere establecer relación entre dos o más de estás.
Mediante una encuesta recopilamos la información de este proyecto los alumnos tengan conocimiento de la evolución del arte y los medios de comunicación en la información y su importancia para la institución.
Actualmente, y debido al desarrollo tecnológico de campos como la informática y la electrónica, la mayoría de las bases de datos están en formato digital, siendo este un componente electrónico, por tanto se ha desarrollado y se ofrece un amplio rango de soluciones al problema del almacenamiento de datos.
Inteligencia Artificial y Ciberseguridad.pdfEmilio Casbas
Recopilación de los puntos más interesantes de diversas presentaciones, desde los visionarios conceptos de Alan Turing, pasando por la paradoja de Hans Moravec y la descripcion de Singularidad de Max Tegmark, hasta los innovadores avances de ChatGPT, y de cómo la IA está transformando la seguridad digital y protegiendo nuestras vidas.
1. INSTITUTO TECNOLOGICO SUPERIOR DE LERDO
MANUAL DE USO DEL SISTEMA SHINE SYSTEM EN C#
ALUMNO:
RAFAEL ALFREDO QUINTANA HERRADA
MATERIA:
TALLER DE BASE DE DATOS
PROFESOR:
RICARDO BUSTAMANTE GONZÁLEZ
Lunes 24 de mayo de 2010
2. 1.- Como primera interfaz tenemos el form principal
El cual contiene un pictureboox, 2 labels y 1 progressbar, esta forma también tendremos
un timer el cual tendrá el siguiente código;
private void timer1_Tick(object sender, EventArgs e)
{
progressBar1.Maximum = 100;
progressBar1.Value++;
if (progressBar1.Value == 100)
{
timer1.Stop();
MessageBox.Show("BASE DE DATOS CONECTADA");
Form2 ventana = new Form2();
this.Hide();
ventana.Show();
}
}
y en la load form contendra el siguiente codigo;
private void Form1_Load(object sender, EventArgs e)
{
timer1.Start();
con = new System.Data.SqlClient.SqlConnection();
con.ConnectionString = " Data
Source=RAFA1SQLEXPRESS;AttachDbFilename=I:ProgramasShine SystemShine
SystemNegocio.mdf;Integrated Security=True";
try
{
con.Open();
con = new System.Data.SqlClient.SqlConnection();
con.ConnectionString = " Data Source=RAFA1SQLEXPRESS;AttachDbFilename=I:
ProgramasShine SystemShine SystemNegocio.mdf;Integrated Security=True";
con.Close();
}
catch
{
MessageBox.Show("BASE DE DATOS NO CONECTADA");
}
}
3. 2.- el segundo form tiene la siguiente interfaz
La siguiente forma está compuesta por 4 pictureboox y 1 label oculto, cada pictureboox
representa cada una de las opciones de nuestro sistema, en orden de izquierda a
derecha tenemos la opción “entrar al login”,”registrar usuario”, “Modificar Usuario” y
“cerrar”
3.- para la animación de los pictureboox es necesario activar los eventos mousmovie y
mouseleave ejemplo;
private void pictureBox3_MouseMove(object sender, MouseEventArgs e)
{
pictureBox7.Visible = false;
}
private void pictureBox3_MouseLeave(object sender, EventArgs e)
{
pictureBox7.Visible = true;
pictureBox3.Visible = false;
}
4.- en el evento mouse clic de cada uno de los pictureboox
En el evento click de “entrar al login” contendrá el siguiente código;
private void pictureBox3_Click_1(object sender, EventArgs e)
{
if (label1.Text == "0")
{
Form7 vent = new Form7();
this.Close();
vent.ShowDialog();
}
else
{
Form23 vent = new Form23();
this.Close();
vent.ShowDialog();
}
}
En el evento click de “Agregar usuario” contendrá el siguiente código;
4. private void pictureBox1_Click(object sender, EventArgs e)
{
if (label1.Text == "0")
{
MessageBox.Show("NO PUEDES AGREGAR... LA BASE DE DATOS ESTA VACIA");
}
else
{
Form20 vent = new Form20();
this.Close();
vent.ShowDialog();
}
}
En el evento click de “modificar usuario” contendrá el siguiente código;
private void pictureBox2_Click(object sender, EventArgs e)
{
if (label1.Text == "0")
{
MessageBox.Show("No Existe Ningun Usuario En La Base De Datos ");
}
else
{
Form20 vent = new Form20();
this.Close();
vent.ShowDialog();
}
}
En el evento click de “Cerrar” contendrá el siguiente código;
private void pictureBox4_Click(object sender, EventArgs e)
{
this.Close();
Application.Exit();
}
EN LA FORMA 3 TENDREMOS LA SIGUIENTE INTERFAZ;
La forma 3 está compuesta por 4 labels, 3 textbox y un botón “Aceptar”.
El botón aceptar contiene el siguiente código;
5. if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "")
{
MessageBox.Show("Faltan datos por llenar");
}
else
{
// abriendo la conexion o enlace
con = new System.Data.SqlClient.SqlConnection();
con.ConnectionString = " Data
Source=RAFA1SQLEXPRESS;AttachDbFilename=I:ProgramasShine SystemShine
SystemNegocio.mdf;Integrated Security=True";
if (condicion == 1)
{
string buscar = "SELECT * from usuarios where usuario= '" + textBox1.Text +
"'";
ORDEN = new SqlCommand(buscar, con);
ORDEN.Connection.Open();
ORDEN.ExecuteNonQuery();
reader = ORDEN.ExecuteReader();
reader.Read();
if (reader.HasRows)
{
MessageBox.Show("El Usuario " + textBox1.Text + " ya existe Ingresa Otro
Nombre");
textBox1.Text = "";
}
else
{
if (textBox2.Text == textBox3.Text)
{
// abriendo la conexion o enlace
con = new System.Data.SqlClient.SqlConnection();
con.ConnectionString = " Data
Source=RAFA1SQLEXPRESS;AttachDbFilename=I:ProgramasShine SystemShine
SystemNegocio.mdf;Integrated Security=True";
string q = "insert into usuarios(usuario,clave)
values(@usuario,@clave)";
SqlCommand ORDEN1 = new SqlCommand(q, con);
ORDEN1 = new SqlCommand(q, con);
ORDEN1.Parameters.Add(new SqlParameter("@usuario", textBox1.Text));
ORDEN1.Parameters.Add(new SqlParameter("@clave", textBox2.Text));
ORDEN1.Connection.Open();
ORDEN1.ExecuteNonQuery();
ORDEN1.Connection.Close();
MessageBox.Show("El Usuario " + textBox1.Text + " se registro con
exito");
textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = "";
Form4 ven = new Form4();
this.Close();
ven.ShowDialog();
}
else
{
MessageBox.Show("La contraseña no Coincide");
textBox2.Text = ""; textBox3.Text = "";
}
}
En la forma 4 (PRINCIPAL) tenemos la siguiente interfaz;
6. La cual contiene 6 pictureboox los cuales de izquierda a derecha son “clientes”,
“Proveedores”, “Productos”, “Ventas”, “cerrar Sesión”, “Salir”
El pictureboox “cliente” contiene el siguiente código;
private void pictureBox1_Click(object sender, EventArgs e)
{
Form5 ven = new Form5();
this.Close();
ven.ShowDialog();
}
El pictureboox “Proveedor” contiene el siguiente código;
private void pictureBox3_Click(object sender, EventArgs e)
{
Form11 vent = new Form11();
this.Close();
vent.ShowDialog();
}
El pictureboox “Productos” contiene el siguiente código;
private void pictureBox5_Click(object sender, EventArgs e)
{
Form15 vent = new Form15();
this.Close();
vent.ShowDialog();
}
El pictureboox “Ventas” contiene el siguiente código;
private void pictureBox10_Click(object sender, EventArgs e)
{
Form19 vent = new Form19();
this.Close();
vent.ShowDialog();
}
El pictureboox “Cerrar Sesión” contiene el siguiente código;
7. private void pictureBox12_Click(object sender, EventArgs e)
{
Form2 vent = new Form2();
this.Close();
vent.Show();
}
El pictureboox “Cerrar” contiene el siguiente código;
private void pictureBox7_Click(object sender, EventArgs e)
{
this.Close();
Application.Exit();
}
El form 5 contiene la siguiente interfaz
El cual contiene 4 pictureboox, el cual de izquierda a derecha son “Altas”, “Bajas” y
“Cambios”;
Altas de los clientes;
El cual tendrá los siguientes componentes 11 labels y 11 textbox con 2 pictureboox en la parte
inferior
El pictureboox 1 contiene el siguiente código
8. // Altas de los clientes
private void pictureBox1_Click(object sender, EventArgs e)
{
if (textBox6.Text == "" || textBox1.Text == "" || textBox2.Text == "" ||
textBox5.Text == "" || textBox7.Text == "" || textBox8.Text == "" || textBox9.Text == "" ||
textBox3.Text == "" || textBox23.Text == "")
{
MessageBox.Show("Faltan datos por llenar");
}
else
{
// abriendo la conexion o enlace
con = new System.Data.SqlClient.SqlConnection();
con.ConnectionString = " Data Source=RAFA1SQLEXPRESS;AttachDbFilename=I:
ProgramasShine SystemShine SystemNegocio.mdf;Integrated Security=True";
string q = "insert into
Clientes(Id_cte,Nombre,Apellido_Paterno,Apellido_Materno,Direccion,Calle,Edo,E_mail,Telefono
,Edad,C_P)
values(@Id_cte,@Nombre,@Apellido_Paterno,@Apellido_Materno,@Direccion,@Calle,@Edo,@E_mail,@T
elefono,@Edad,@C_P)";
SqlCommand ORDEN = new SqlCommand(q, con);
ORDEN = new SqlCommand(q, con);
ORDEN.Parameters.Add(new SqlParameter("@Id_cte", textBox6.Text));
ORDEN.Parameters.Add(new SqlParameter("@nombre", textBox1.Text));
ORDEN.Parameters.Add(new SqlParameter("@Apellido_Paterno", textBox2.Text));
ORDEN.Parameters.Add(new SqlParameter("@Apellido_Materno", textBox3.Text));
ORDEN.Parameters.Add(new SqlParameter("@Direccion", textBox7.Text));
ORDEN.Parameters.Add(new SqlParameter("@Calle", textBox8.Text));
ORDEN.Parameters.Add(new SqlParameter("@Edo", textBox9.Text));
ORDEN.Parameters.Add(new SqlParameter("@E_mail", textBox10.Text));
ORDEN.Parameters.Add(new SqlParameter("@Telefono", textBox11.Text));
ORDEN.Parameters.Add(new SqlParameter("@Edad", textBox23.Text));
ORDEN.Parameters.Add(new SqlParameter("@C_P", textBox5.Text));
ORDEN.Connection.Open();
ORDEN.ExecuteNonQuery();
ORDEN.Connection.Close();
MessageBox.Show("El Usuario " + textBox1.Text + " " + textBox2.Text + " se
registro con exito");
textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox23.Text =
""; textBox5.Text = "";
textBox7.Text = ""; textBox8.Text = ""; textBox9.Text = ""; textBox10.Text =
""; textBox11.Text = ""; Form4 ven = new Form4();
Form4 vent = new Form4();
this.Close();
ven.Show();
}
}
El form load contiene el siguiente código;
private void Form6_Load(object sender, EventArgs e)
{
9. con = new System.Data.SqlClient.SqlConnection();
con.ConnectionString = " Data
Source=RAFA1SQLEXPRESS;AttachDbFilename=I:ProgramasShine SystemShine
SystemNegocio.mdf;Integrated Security=True";
try
{
con.Open();
string Sql = "SELECT Count(Id_cte) FROM Clientes";
SqlCommand aux = new SqlCommand(Sql, con);
int numRegistros = ((int)aux.ExecuteScalar()) + 1;
con.Close();
label1.Text = "Registros: " + (numRegistros - 1).ToString();
//llenar el textbox con el ID
textBox6.Text = numRegistros.ToString();
}
catch (Exception)
{
MessageBox.Show("Conexión fallida");
this.Close();
}
}
Despues tenemos la interfaz de bajas de Clientes
El cual contiene 1 label, 1 textbox, 1 botón y 1 datagridview
El botón “eliminar contiene el siguiente código”;
private void button1_Click_1(object sender, EventArgs e)
{
con = new System.Data.SqlClient.SqlConnection();
con.ConnectionString = " Data
Source=RAFA1SQLEXPRESS;AttachDbFilename=I:ProgramasShine SystemShine
SystemNegocio.mdf;Integrated Security=True";
try
{
string buscar = "SELECT * from Clientes where Id_cte= '" + textBox1.Text +
"'";
SqlCommand ORDEN = new SqlCommand(buscar, con);
ORDEN.Connection.Open();
ORDEN.ExecuteNonQuery();
SqlDataReader reader = ORDEN.ExecuteReader();
reader.Read();
if (reader.HasRows)
{
con2 = new System.Data.SqlClient.SqlConnection();
con2.ConnectionString = " Data
Source=RAFA1SQLEXPRESS;AttachDbFilename=I:ProgramasShine SystemShine
SystemNegocio.mdf;Integrated Security=True";
10. if (MessageBox.Show("¿Eliminar el cliente " + textBox1.Text + "?",
"Confirmar", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
string eliminar = "DELETE FROM Clientes WHERE Id_cte='" +
textBox1.Text + "'";
SqlCommand ORDEN2 = new SqlCommand(eliminar, con2);
ORDEN2.Connection.Open();
ORDEN2.ExecuteNonQuery();
MessageBox.Show("cliente eliminado");
textBox1.Text = "";
Form4 vent = new Form4();
this.Close();
vent.Show();
}
else
{
MessageBox.Show("No se puede eliminar el cliente");
}
}
else
{
MessageBox.Show("el cliente proporcionado no existe");
textBox1.Text = "";
}
}
catch
{
MessageBox.Show("Conexion fallida");
}
}
Ahora tenemos la interfaz de los cambios de los clientes
El cual cuenta con 11 textbox y 11 labels y 1 botón, 4 pictureboox y 1 datagridview
El botón de actualizar contiene el siguiente código;
private void button1_Click(object sender, EventArgs e)
{
con = new System.Data.SqlClient.SqlConnection();
con.ConnectionString = " Data Source=RAFA1SQLEXPRESS;AttachDbFilename=I:
ProgramasShine SystemShine SystemNegocio.mdf;Integrated Security=True";
// 1 Clave ya
SqlCommand ORDEN = new SqlCommand("SELECT Id_cte from Clientes where Id_cte=
'" + textBox14.Text + "'", con);
ORDEN.Connection.Open(); ORDEN.ExecuteNonQuery(); SqlDataReader reader =
ORDEN.ExecuteReader(); reader.Read();
try { if (reader.HasRows) { textBox6.Text = reader.GetString(0); } }
catch (Exception) { textBox6.Text = ""; }
11. reader.Close(); ORDEN.Connection.Close();
// telefono ya
SqlCommand ORDEN1 = new SqlCommand("SELECT Telefono from Clientes where
Id_cte= '" + textBox14.Text + "'", con);
ORDEN.Connection.Open(); ORDEN.ExecuteNonQuery(); SqlDataReader reader2 =
ORDEN.ExecuteReader(); reader2.Read();
try { if (reader.HasRows) { textBox11.Text = reader.GetString(0); } }
catch (Exception) { textBox11.Text = ""; }
reader.Close(); ORDEN.Connection.Close();
// 2 Nombre ya
SqlCommand ORDEN2 = new SqlCommand("SELECT nombre from Clientes where
Id_cte= '" + textBox14.Text + "'", con);
ORDEN2.Connection.Open(); ORDEN2.ExecuteNonQuery();
SqlDataReader reader15 = ORDEN2.ExecuteReader(); reader15.Read();
try { if (reader15.HasRows) { textBox1.Text = reader15.GetString(0); } }
catch (Exception) { textBox1.Text = ""; }
reader15.Close(); ORDEN2.Connection.Close();
// 3 Apellido paterno ya
SqlCommand ORDEN3 = new SqlCommand("SELECT Apellido_Paterno from Clientes
where Id_cte= '" + textBox14.Text + "'", con);
ORDEN3.Connection.Open(); ORDEN3.ExecuteNonQuery();
SqlDataReader reader3 = ORDEN3.ExecuteReader(); reader3.Read();
try { if (reader3.HasRows) { textBox2.Text = reader3.GetString(0); } }
catch (Exception) { textBox2.Text = ""; }
reader3.Close(); ORDEN3.Connection.Close();
// 4 Apellido materno ya
SqlCommand ORDEN4 = new SqlCommand("SELECT Apellido_Materno from Clientes
where Id_cte= '" + textBox14.Text + "'", con);
ORDEN4.Connection.Open(); ORDEN4.ExecuteNonQuery();
SqlDataReader reader4 = ORDEN4.ExecuteReader(); reader4.Read();
try { if (reader4.HasRows) { textBox3.Text = reader4.GetString(0); } }
catch (Exception) { textBox3.Text = ""; } reader4.Close();
ORDEN4.Connection.Close();
// 5 Telefono ya
SqlCommand ORDEN5 = new SqlCommand("SELECT Telefono from Clientes where
Id_cte= '" + textBox14.Text + "'", con);
ORDEN5.Connection.Open(); ORDEN5.ExecuteNonQuery();
SqlDataReader reader5 = ORDEN5.ExecuteReader(); reader5.Read();
try { if (reader5.HasRows) { textBox11.Text = reader5.GetString(0); } }
catch (Exception) { textBox11.Text = ""; } reader5.Close();
ORDEN5.Connection.Close();
// 6 Calle ya
SqlCommand ORDEN6 = new SqlCommand("SELECT Calle from Clientes where Id_cte=
'" + textBox14.Text + "'", con);
ORDEN6.Connection.Open(); ORDEN6.ExecuteNonQuery();
SqlDataReader reader6 = ORDEN6.ExecuteReader(); reader6.Read();
try { if (reader6.HasRows) { textBox8.Text = reader6.GetString(0); } }
catch (Exception) { textBox8.Text = ""; } reader6.Close();
ORDEN6.Connection.Close();
// 7 direccion ya
SqlCommand ORDEN7 = new SqlCommand("SELECT Direccion from Clientes where
Id_cte= '" + textBox14.Text + "'", con);
ORDEN7.Connection.Open(); ORDEN7.ExecuteNonQuery();
SqlDataReader reader7 = ORDEN7.ExecuteReader(); reader7.Read();
try { if (reader7.HasRows) { textBox7.Text = reader7.GetString(0); } }
catch (Exception) { textBox7.Text = ""; } reader7.Close();
ORDEN7.Connection.Close();
// 8 e.mail ya
SqlCommand ORDEN8 = new SqlCommand("SELECT E_mail from Clientes where
Id_cte= '" + textBox14.Text + "'", con);
ORDEN8.Connection.Open(); ORDEN8.ExecuteNonQuery();
SqlDataReader reader8 = ORDEN8.ExecuteReader(); reader8.Read();
try { if (reader8.HasRows) { textBox10.Text = reader8.GetString(0); } }
catch (Exception) { textBox10.Text = ""; }
reader8.Close(); ORDEN8.Connection.Close();
// 10 Estado
SqlCommand ORDEN11 = new SqlCommand("SELECT Edo from Clientes where Id_cte=
'" + textBox14.Text + "'", con);
ORDEN11.Connection.Open(); ORDEN11.ExecuteNonQuery();
SqlDataReader reader11 = ORDEN11.ExecuteReader(); reader11.Read();
try { if (reader11.HasRows) { textBox9.Text = reader11.GetString(0); } }
13. Y el la forma se carga el siguiente codigo;
DataSet TABLA;
SqlDataAdapter ORDEN;
CANAL = new SqlConnection("Data
Source=RAFA1SQLEXPRESS;AttachDbFilename=I:ProgramasShine SystemShine
SystemNegocio.mdf;Integrated Security=True");
string q = "select * from Clientes";
ORDEN = new SqlDataAdapter(q, CANAL);
// Creando el dataset y cargandolo
TABLA = new DataSet();
ORDEN.Fill(TABLA, "Clientes");
// Cargando el datagridview
dataGridView1.DataSource = TABLA;
dataGridView1.DataMember = "Clientes";
con = new System.Data.SqlClient.SqlConnection();
con.ConnectionString = " Data
Source=RAFA1SQLEXPRESS;AttachDbFilename=I:ProgramasShine SystemShine
SystemNegocio.mdf;Integrated Security=True";
con.Open();
//Cuento registros
string strSql = "SELECT Count(Id_cte) FROM Clientes";
SqlCommand cmd = new SqlCommand(strSql, con);
int numRegistros = ((int)cmd.ExecuteScalar()) + 1;
con.Close();
label1.Text = "Registros: " + (numRegistros - 1).ToString();
}
En esta forma tenemos la opción ventas
La cual contiene 5 textboc y 2 combobox 4 picturebox y 8 labels
El picturebox1 de aceptar contiene el siguiente codigo;
14. private void pictureBox1_Click(object sender, EventArgs e)
{
if (textBox1.Text == "" || textBox2.Text == "" || textBox5.Text == "" ||
textBox3.Text == "")
{
MessageBox.Show("Faltan datos por llenar o No Calculaste EL TOTAL");
}
else
{
// abriendo la conexion o enlace
con = new System.Data.SqlClient.SqlConnection();
con.ConnectionString = " Data
Source=RAFA1SQLEXPRESS;AttachDbFilename=I:ProgramasShine SystemShine
SystemNegocio.mdf;Integrated Security=True";
string q = "insert into
Ventas(id_vta,fecha,cantidad,total,id_prod,id_cte,presio)
values(@id_vta,@fecha,@cantidad,@total,@id_prod,@id_cte,@presio)";
SqlCommand ORDEN = new SqlCommand(q, con);
ORDEN = new SqlCommand(q, con);
ORDEN.Parameters.Add(new SqlParameter("@id_vta", textBox4.Text));
ORDEN.Parameters.Add(new SqlParameter("@fecha", textBox1.Text));
ORDEN.Parameters.Add(new SqlParameter("@cantidad", textBox2.Text));
ORDEN.Parameters.Add(new SqlParameter("@total", textBox3.Text));
ORDEN.Parameters.Add(new SqlParameter("@id_prod", comboBox2.Text));
ORDEN.Parameters.Add(new SqlParameter("@id_cte", comboBox3.Text));
ORDEN.Parameters.Add(new SqlParameter("@presio", textBox5.Text));
ORDEN.Connection.Open();
ORDEN.ExecuteNonQuery();
ORDEN.Connection.Close();
MessageBox.Show("La Venta " + textBox4.Text + " se registro con exito");
textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text =
""; textBox5.Text = "";
Form4 ven = new Form4();
this.Close();
ven.Show();
}
}