storing sql statements and reusing in asp.net

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
 
E

Eliyahu Goldin

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
 
S

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/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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top