storing sql statements and reusing in asp.net

  • Thread starter Thread starter Simone
  • Start date Start date
S

Simone

Hello

I am pretty new to asp.net :)

I have a program that loops through a few sql statements and performs
inserts.
The problem is the sql statements are different for every upcoming new
study we do but the program is pretty much the same.

I need an efficient way to store new statements as the are available
to me and use them in the program

I would have something like this.
strselecttest1 = "select * from tbltest1"
strselecttest2 = "select * from tbltest2"

Then my program would go off the value I am passing like (1,2) and
select the appropriate select statement either
strselecttest1 or strselecttest2 from this specific place, file???

Where do I store these statements? On my class/page itself or
somewhere else?

Thanks
Simone
 
There is no difference between select statements and any other resources you
need to select dynamically. What is the good place of storing them depends
on many factors. How many items are there, how they are organized, how you
are gong to maintain them etc. You may consider using a database, a xml
file, a text file, the web.config file. Plenty of choice.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
 
There is no difference between select statements and any other resources you
need to select dynamically. What is the good place of storing them depends
on many factors. How many items are there, how they are organized, how you
are gong to maintain them etc. You may consider using a database, a xml
file, a text file, the web.config file. Plenty of choice.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]http://msmvps.com/blogs/egoldinhttp://usableasp.net




I am pretty new to asp.net :)
I have a program that loops through a few sql statements and performs
inserts.
The problem is the sql statements are different for every upcoming new
study we do but the program is pretty much the same.
I need an efficient way to store new statements as the are available
to me and use them in the program
I would have something like this.
strselecttest1 = "select * from tbltest1"
strselecttest2 = "select * from tbltest2"
Then my program would go off the value I am passing like (1,2) and
select the appropriate select statement either
strselecttest1 or strselecttest2 from this specific place, file???
Where do I store these statements? On my class/page itself or
somewhere else?
Thanks
Simone- Hide quoted text -

- Show quoted text -

Thank you.

I have decided to use an xml file. I will load the xml file in my
class and capture the select statement and put it in a string
variable. Then later I will run the string and open the recordset.
 
Back
Top