Procedimiento almacenado

USE [alumnosutsc] GO CREATE PROCEDURE [sp_insAlumno] (@Matricula [int], @Nombre[nvarchar](50), @Calificacion1[int], @Calificacion2[int], @Calificacion3[int] ) AS INSERT INTO [alumnosutsc].[dbo].[alumno] ( [Matricula], [Nombre], [Calificacion1], [Calificacion2], [Calificacion3] ) VALUES ( @Matricula, @Nombre, @Calificacion1, @Calificacion2, @Calificacion3 ) Codigo del programa en ASP .NET C# using using using using using using using using using using using using using System; System.Collections; System.Configuration; System.Data; System.Linq; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.HtmlControls; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Xml.Linq; System.Data.SqlClient;

namespace WebApplication17 { public partial class WebForm1 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { }

Int)." + "Initial Catalog=alumnosutsc.Int).Text += err.Parameters.ConnectionString = "Data Source=localhost.Input.myConnection). SqlDbType. param = insertCommand. } insertCommand. param = insertCommand. TextBox4.ToInt32(TextBox1.Text == "" || TextBox2.Input.ToInt32(TextBox3. added = insertCommand.ToString() + "Registro Insertado". param.Text = "".NVarChar.Text == "" | TextBox5. param. if (TextBox1. return.Value = Convert. TextBox3.Direction = ParameterDirection. SqlDbType. param.Text = "".Text = "Debe llenar todos los campos".SqlDbType.Text == "" || TextBox3. try { myConnection.Input.Text == "") { Label6.Open(). param.Direction = ParameterDirection.Add("@Calificacion3".Add("@Matricula".Message. SqlParameter param.Parameters.Value = Convert. EventArgs e) { SqlConnection myConnection = new SqlConnection(). TextBox1.Add("@Calificacion1".Text == "" || TextBox4.50).Text = "".Direction = ParameterDirection.Direction = ParameterDirection.Parameters.Text.Close().ToInt32(TextBox5.Parameters. param = insertCommand. param = insertCommand.Add("@Calificacion2". } finally { myConnection. param. } catch (Exception err) { Label6.CommandType = CommandType.Text).ExecuteNonQuery(). param.Input.ToInt32(TextBox4.Add("@Nombre".Text). Label6.Text).Text).Text = "".Text = added. param.Text = "".Text = "Error al Insertar Registro". Label6. param. TextBox2. SqlDbType. SqlCommand insertCommand = new SqlCommand(strSQLInsert. param = insertCommand.Parameters.Value = Convert. myConnection. param.Int).Integrated Security=SSPI". string strSQLInsert = "[sp_insAlumno]".Input.protected void Button1_Click(object sender. int added = 0.Direction = ParameterDirection.StoredProcedure. param.Value = Convert. TextBox5.Value = TextBox2. .Int). SqlDbType.

TextBox3. TextBox5. TextBox4.Text = "".Text = "". EventArgs e) { TextBox1. } } } .Text = "".} } protected void Button2_Click(object sender.Text = "".Text = "". TextBox2.

Sign up to vote on this title
UsefulNot useful