Click here to Skip to main content
12,956,606 members (69,804 online)
Rate this:
Please Sign up or sign in to vote.
See more:
protected void Button1_Click(object sender, EventArgs e)
   {   count++;
       int noofcount = count;
       Label6.Text = noofcount.ToString();
       if (noofcount > 5)
       {    string ch = "Attacker";
                     con = new SqlConnection("Data Source=Database; Initial Catalog=firecol; User Id=sa; Pwd=password");
           cmd = new SqlCommand("update normaluser set type='" + ch + "' where username='" + Label5.Text + "'", con);
 {String bl = "", la = "";
           con = new SqlConnection("Data Source=FABSYS39\\SQLEXPRESS; Initial Catalog=firecol; User Id=sa; Pwd=saadmin");
 cmd = new SqlCommand("Insert into questions Values('" + Label5.Text + "','" + ddldetails.SelectedItem.Text + "','" + DropDownList2.SelectedItem.Text + "','" + TextBox1.Text + "','" + la + "','" + bl + "')", con);
           Label4.Visible = true;

i wanna clear this button clcik count while i leaving in this can i clear that??? pls help me???
Posted 18-Nov-12 22:51pm
Updated 18-Nov-12 23:10pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You can keep a flag that indicates you to reset. Then In the page load event check IsPostBack, if it is not true, not if your flag suggests you to reset count, reset it.

Wait a minute, Why are you giving your SQL server name, id, password in open?

Are you not scared !!!

deenujii 19-Nov-12 5:29am
tat password and id s fake ly sir....
deenujii 19-Nov-12 5:29am
now it's working correctly.... thank u sir....

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 6,869
CHill60 3,550
Maciej Los 3,302
ppolymorphe 2,080
Jochen Arndt 1,973

Advertise | Privacy | Mobile
Web02 | 2.8.170525.1 | Last Updated 19 Nov 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100