7
Answers

New user. Variables question.

tdiddy67

tdiddy67

20y
1.8k
1
Hello, I've just started learning C# and I'm having some troubles getting a grip on how variables are used. I've building a web app to access a SQL database to retrieve data, and insert data. I built it using a tutorial I found in the Microsoft help files. Anyway, what I want to do is retrieve data from some fields in a table, store the values in variables, and then re-write the values to a table. I declared a variable at the beginning of the class... public String Qty; ...and I'm able to use the variable in any method. However, I want to be able to add a value to the variable in one method, and then use it in another method to insert data to the table. I'm unable to retain the value outside of the method that it is assigned in. Any insight would be greatly appreciated.
Answers (7)