473,396 Members | 1,816 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

having a hard time with things falling out of scope please help

I am building a web ap and have a webform1 an agreement.cs and a files.cs going to an access database
I am not having problems reading or writing to the database but I have hit a snag on how to keep my
variables from falling out of scope to write back to the webform.

in webform1 I am calling a fcn in files.cs to read the values for a certain agreement number and writing
those values to the variables in agreement.cs...this works.
but when I return to the calling fcn in the webform I can no longer write these variables to the text boxes for
display because it has fallen out of scope.
any help would be greatly appreciated.

thanks again
sparks
================
WEBFORM
--
private void contractread_Click(object sender, System.EventArgs e)
{
db.readAgreement(AgreementList.SelectedValue.ToStr ing());
PanelContractInfo.Visible=true;
ContractNumber.Text=agreement.getContractNumber();
ExpDate.Text=agreement.getExpDate();
Status.Text=agreement.getStatus();
Allowed.Text=agreement.getAllowed();
}

================
files.cs
--
public Agreement readAgreement(string ContractNumber)
{
string sCommand = "Select * From tblAgreement Where ContractNumber = " + ContractNumber;
OleDbCommand cmd = new OleDbCommand(sCommand, Connection);
cmd.CommandType = CommandType.Text;
Connection.Open();
OleDbDataReader reader = cmd.ExecuteReader();
if(reader.Read())
{
return new Agreement(
reader.GetValue(0).ToString(),
reader.GetValue(1).ToString(),
reader.GetValue(2).ToString(),
reader.GetValue(3).ToString()
);
}
================
Agreement.cs
public class Agreement
{
private string ContractNumber;
private string ExpDate;
private string Status;
private string Allowed;
}
Nov 16 '05 #1
3 1271
"sparks" <jo***@lost.net> ha scritto nel messaggio
news:3s********************************@4ax.com...
================
WEBFORM
--
private void contractread_Click(object sender, System.EventArgs e)
{
db.readAgreement(AgreementList.SelectedValue.ToStr ing());
PanelContractInfo.Visible=true;
ContractNumber.Text=agreement.getContractNumber();
ExpDate.Text=agreement.getExpDate();
Status.Text=agreement.getStatus();
Allowed.Text=agreement.getAllowed();
}


Where are you declaring the "agreement" variable?
And where are you putting the return value from ReadAgreement()?
Shouldn't it be something like "Agreement agreement =
db.readAgreement(...);"?

Massimo

Nov 16 '05 #2
Thank You VERY MUCH...
I would Like to say DOH but I don't even deserve that.

thanks again

sparks

On Sun, 5 Dec 2004 17:39:38 +0100, "Massimo" <ba****@mclink.it> wrote:
"sparks" <jo***@lost.net> ha scritto nel messaggio
news:3s********************************@4ax.com.. .
================
WEBFORM
--
private void contractread_Click(object sender, System.EventArgs e)
{
db.readAgreement(AgreementList.SelectedValue.ToStr ing());
PanelContractInfo.Visible=true;
ContractNumber.Text=agreement.getContractNumber();
ExpDate.Text=agreement.getExpDate();
Status.Text=agreement.getStatus();
Allowed.Text=agreement.getAllowed();
}


Where are you declaring the "agreement" variable?
And where are you putting the return value from ReadAgreement()?
Shouldn't it be something like "Agreement agreement =
db.readAgreement(...);"?

Massimo


Nov 16 '05 #3
"sparks" <jo***@lost.net> ha scritto nel messaggio
news:s5********************************@4ax.com...
Thank You VERY MUCH...
I would Like to say DOH but I don't even deserve that.


Don't worry, it happens lots of times to anyone :-)

Massimo

Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Michael C | last post by:
Hi all, I'm still having problems with VS.NET 2003 running on my XP machine. I finally decided I might as well uninstall completely and reinstall from scratch. But lo and behold it won't let...
3
by: Henrik Dahl | last post by:
Hello! From default, the ASPNET user is giving the process identity for the ASP.NET runtime environment of IIS, however it's possible to change the user by modifying the <processModel> element...
32
by: mentochan | last post by:
It was heard that VB is not fitful for OO programming, and MS is falling into a hardtime to maintain such product. I myself don't think it's true. Is there any articles talk about this?
11
by: Joseph S. | last post by:
Hi all, how do I avoid typing the keyword "$this->" every time I need to reference a member of a class inside the class? (coming from a world of cozy auto-complete enabled Java / .Net IDEs I...
2
by: rustyc | last post by:
Well, here's my first post in this forum (other than saying 'HI' over in the hi forum ;-) As I said over there: ... for a little side project at home, I'm writing a ham radio web site in...
7
by: =?Utf-8?B?UGV0ZXI=?= | last post by:
Dear, I do have an ASP page with vbscript code entirely executed on the IIS server. The page contains a lot of data coming from the SQL Server. I want to populate one of the <selectboxes on that...
5
by: smittie31 | last post by:
I am having a problem with a border around me html page. The border does not flow thru the whole html page, it cuts off halfway. --> See http://keithborom.com/marlon-sanders CSS STYLESHEET ...
9
by: Raistlin Majere | last post by:
Take a look at the source code and the number of files of phpdug. click choose download at http://www.kubelabs.com/phpdug/ and select 1.4.2 How much time and money is needed to create a...
9
by: raylopez99 | last post by:
Just an observation: pens for drawing lines in Win Forms are tricky when assignment is inside the paint handler. inside of the Paint handler, but not inside a "using" brace (that is, outside of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.