You are on page 1of 2

using using using using using using using using using using using

System; System.Collections.Generic; System.Linq; System.Web; System.Web.UI; System.Web.UI.WebControls; System.Data.SqlClient; System.Web.Configuration; System.Configuration; System.Data.OleDb; System.Data;

public partial class Reg : System.Web.UI.Page { // private String t; private String id; //private String appId; //private String h = "3434"; protected void Page_Load(object sender, EventArgs e) { // SqlConnection conn = new SqlConnection(strConnString); //if (HttpUtility.UrlDecode(System.Web.HttpContext.Current.Request.QueryS tring["h"]).ToString() != "3434") // { // return; // } using (SqlConnection connection = new SqlConnection()) { //SqlDataReader rdr = null; string strConnString = ConfigurationManager.ConnectionStrings["myconn ectionString"].ConnectionString; connection.ConnectionString = strConnString; connection.Open(); // 1. Crea un objeto command identificando al procedimiento almacenad o SqlCommand cmd = new SqlCommand("SaveSubscribers", connection); // 2. configurar el objeto command para ejecutar el procedimiento alm acenado cmd.CommandType = CommandType.StoredProcedure; // 3. agregar parametros al objeto command, los cuales seran pasados al procedimiento almacenado cmd.Parameters.Add(new SqlParameter("@token", "6256543211124254")); cmd.Parameters.Add(new SqlParameter("@ID", "50")); cmd.Parameters.Add(new SqlParameter("@CreateDate", Convert.ToDateTime ("2013-03-12"))); cmd.Parameters.Add(new SqlParameter("@AplicationId", 3)); cmd.ExecuteReader();

//rdr = cmd.ExecuteReader(); // EN CASO DE UN SELECT ////string insertStatement = "INSERT INTO Test(id) VALUES ('987654321 ')"; //string insertStatement = "INSERT INTO Subscribers(Token,ID,CreateDa te,AplicationId) VALUES ('665654321112254','2','2011-03-12','5')"; //SqlCommand sqlCommand = new SqlCommand(insertStatement, connection) ; //sqlCommand.ExecuteNonQuery(); //connection.Close(); } id = Request.QueryString["id"].ToString(); tbMessage.Text = Request.QueryString["id"]; } }

You might also like