Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

global variable

Status
Not open for further replies.

nnmmss

Programmer
Sep 7, 2004
123
0
0
IR
I have a table which has a row with four column, when ever i want these values (4 columns) i connect to the database and get the specified values through the stored procedure.
these 4 values could be used in any part or any form in application.

now my question is that for having better performance , isn't it better i just get these 4 values once ( when the applcation starts) and keep it in global variable?
or it is better to fetch it from databse whenever i need them
 

How often does the data change?
How long could your app be left running for?
These answers will tell you whether it's worth considering using Public variable and only loading once. I also noticed in another of your posts that you seem to be using Excel as a database. If that is the case, then loading and unloading Excel each time will be very slow. You may do better to consider an alternative mechanism for data storage. Depending on your application needs it could be a simple text file, it could be an mdb or it could be a SQL db of some kind. If you have no other data storage requirements, consider a text file which can be read and written much faster than opening Excel.

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
 
well actually the main database is sql,i use excel not for databse but it i just get one value from it and the rest is done the app.
these four values are four different path of files, so it depends on which form(which can show different file path)
load the value is needed at that time just once when the user is in that form.
 
I will ask the questions again:

How often does the data change?
How long could your app be left running for?

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
 
look there four path , i have kept those path in table .actually the data never changes but depends on which path is needed i'll get that field
 
Given

>the data never changes

then

>isn't it better i just get these 4 values once ( when the applcation starts) and keep it in global variable?

Yes

>or it is better to fetch it from databse whenever i need them

No

(and this was why johnwm was asking the questions that he did)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top