SEPARATA DE MANTENIMIENTO EN C#
Enviado por luis miguel sarmiento gonzales • 13 de Agosto de 2020 • Apuntes • 1.650 Palabras (7 Páginas) • 126 Visitas
SEPARATA DE MANTENIMIENTO EN C#
[pic 1]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
public partial class grabar : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
{
string name = txtName.Text;
string email = txtEmail.Text;
string password = txtPassword.Text;
string address = txtAddress.Text;
try
{
SqlConnection con = new SqlConnection("Data Source=192.168.1.43;Initial Catalog=cliente_servidor;User id = sa; password= 123");
con.Open();
SqlCommand com = new SqlCommand(); // Create a object of SqlCommand class
com.Connection = con; //Pass the connection object to Command
com.CommandType = CommandType.StoredProcedure; // We will use stored procedure.
com.CommandText = "spInsertUser"; //Stored Procedure Name
com.Parameters.Add("@Name", SqlDbType.NVarChar).Value = name;
com.Parameters.Add("@Email", SqlDbType.NVarChar).Value = email;
com.Parameters.Add("@Password", SqlDbType.NVarChar).Value = password;
com.Parameters.Add("@Address", SqlDbType.NVarChar).Value = address;
com.ExecuteNonQuery();
}
catch (Exception ex)
{
}
}
}
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
}
protected void Button2_Click(object sender, EventArgs e)
{
{
string id = txtcodigo.Text;
try
{
SqlConnection con = new SqlConnection("Data Source=192.168.1.43;Initial Catalog=cliente_servidor;User id = sa; password= 123");
con.Open();
SqlCommand com = new SqlCommand(); // Create a object of SqlCommand class
com.Connection = con; //Pass the connection object to Command
com.CommandType = CommandType.StoredProcedure; // We will use stored procedure.
com.CommandText = "elimina"; //Stored Procedure Name
com.Parameters.Add("@idcliente", SqlDbType.NVarChar).Value = id;
com.ExecuteNonQuery();
}
catch (Exception ex) { }
}
}
protected void Button3_Click(object sender, EventArgs e)
{
{
string id = txtcodigo.Text;
string name = txtName.Text;
string email = txtEmail.Text;
string password = txtPassword.Text;
string address = txtAddress.Text;
try
{
SqlConnection con = new SqlConnection
("Data Source = 192.168.1.43; Initial Catalog = cliente_servidor; User id = sa; password = 123");
con.Open();
SqlCommand com = new SqlCommand();
com.Connection = con;
com.CommandType = CommandType.StoredProcedure;
com.CommandText = "actualiza";
...