TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
saranya S
NA
43
56.9k
Check any error in this code
Dec 17 2012 7:31 AM
Hi,
this is my asp.net coding for registration form... i didnt get any error while compiling but after i enter all values when i click that submit buttom nothing happen... that values r not in sql db... i dono why... wats wrong in that..... plz help me frnds.... :)
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 _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void DropDownList5_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void Clear_Click(object sender, EventArgs e)
{
TextBox1.Text = "";
TextBox2.Text = "";
TextBox3.Text = "";
TextBox4.Text = "";
TextBox5.Text = "";
TextBox6.Text = "";
TextBox7.Text = "";
TextBox8.Text = "";
TextBox9.Text = "";
TextBox10.Text = "";
TextBox11.Text = "";
RadioButtonList1.SelectedValue = null;
TextBox12.Text = "";
DropDownList4.SelectedValue = null;
DropDownList5.SelectedValue = null;
CheckBox1.Checked = false;
Label21.Text = "";
}
protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
{
}
protected void RadioButton1_CheckedChanged(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
try
{
SqlConnection con = new SqlConnection("Data Source=SARANYA-TS02\\SQLEXPRESS;Initial Catalog=ss;Integrated Security=True");
string str = "Select E-mail Address from RegistrationForm where E-mail Address='" + TextBox7.Text + "'";
con.Open();
SqlCommand cmd1 = new SqlCommand(str,con);
string emailcheckup = Convert.ToString(cmd1.ExecuteScalar());
if (emailcheckup == string.Empty || emailcheckup == null)
{
SqlCommand cmd = new SqlCommand("insert into RegistrationForm values('" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "','" + TextBox4.Text
+ "','" + TextBox5.Text + "','" + TextBox6.Text + "','" + TextBox7.Text + "','" + TextBox8.Text + "','" + RadioButtonList1.SelectedValue
+ "','" + TextBox12.Text + "','" + TextBox9.Text + "','" + TextBox10.Text
+ "','" + TextBox11.Text + "','" + DropDownList4.SelectedValue + "','" + DropDownList5.SelectedValue + "')", con);
cmd.ExecuteNonQuery();
con.Close();
Response.Write("<script>alert('Record Added')</script>");//This is one of javascript alert
// DataTable dt = new DataTable(str);
//if (dt.Rows.Count > 0)
//{
// Label21.Text = "email id already exists.";
//}
//else
//{
// Label21.Text = "email ID already exists";
// Response.Redirect("E-mail Address already Exists");
//}
}
else
{
Label21.Text = "email ID already exists";
}
}
catch(Exception ex)
{
string errormsg = ex.ToString();
}
}
protected void RadioButton2_CheckedChanged(object sender, EventArgs e)
{
}
protected void TextBox7_TextChanged(object sender, EventArgs e)
{
}
protected void TextBox2_TextChanged(object sender, EventArgs e)
{
}
protected void TextBox3_TextChanged(object sender, EventArgs e)
{
}
protected void TextBox9_TextChanged(object sender, EventArgs e)
{
}
}
Reply
Answers (
2
)
Need code for paging in nested Datalist
c# for desktop or web