selva kumar

selva kumar

  • NA
  • 557
  • 189.8k

Problem on inserting values?

Sep 11 2013 2:07 AM
hi friends i m using asp ajax model pop up extender when i clicking button popup panel appeared with registeration  field...when i fill out the registeration details and clicking submit button it should be stored on sql server database..these values does not stored in database that is my problem..how can i solve can any one help me out...here is my code..

sing System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class popup : System.Web.UI.Page
{
    SqlConnection Con;
    SqlCommand Cmd;
    protected void Page_Load(object sender, EventArgs e)
    {
        Con = new SqlConnection(@"Data Source=.\SQLEXPRESS;Initial Catalog=studentmgmt;Integrated Security=True");
    }
    protected void btnsubmit_Click(object sender, EventArgs e)
    {
        Con.Open();
        Cmd = new SqlCommand("insert into pop values('"+TextBox1.Text+"','"+TextBox2.Text+"','"+TextBox2.Text+"')",Con);
        Cmd.ExecuteNonQuery();
        Con.Close();
    }
}

Answers (3)