Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Santosh Mishra
  Where is Santosh Mishra?
 Santosh Mishra
Subject: .Net Variable problem
Thread ID: 416185 Message ID: 416185 # Views: 54 # Ratings: 0
Version: Unknown Category: C#.NET
Date: Tuesday, December 23, 2014 8:22:55 AM         

At my learning stage I have a prob.

I declared a variable "branch" in Page_Load event
but when I tried to use it in Button2_Click event, it is giving error.

Please help.....

It would good for me, if help will be in my level

protected void Page_Load(object sender, EventArgs e)
string branch= null;
if (Session["sfld1"].ToString() == "ITOFF")
branch = "IT";

protected void Button2_Click(object sender, EventArgs e)
SqlConnection con = new SqlConnection("Server=SDCHO\\SQLEXPRESS;Database=LoginPage;Trusted_Connection=true");
SqlCommand cmd = new SqlCommand();

cmd.CommandText = "Update LeaveDataTable SET BRANCH_OFF= @branch_off1 where Lsr=@Lsr1 and Lbr=@Lbr1";

cmd.Parameters.AddWithValue("@branch_off1", RadioButtonList2.SelectedItem.Value.ToString());
cmd.Parameters.AddWithValue("@Lsr1", Convert.ToInt32(TextBox1.Text));

cmd.Parameters.AddWithValue("@Lbr1", branch);

cmd.Connection = con;
int result = cmd.ExecuteNonQuery();



.Net Variable problem Posted by Santosh Mishra @ 12/23/2014 8:22:55 AM
RE: .Net Variable problem Posted by Borislav Borissov @ 12/23/2014 8:36:49 AM
RE: .Net Variable problem Posted by Zia Mughal @ 12/23/2014 8:51:12 AM
RE: .Net Variable problem Posted by Anil Sharma @ 12/25/2014 7:25:28 PM