473,466 Members | 1,404 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

storing sql statements and reusing in asp.net

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

Mar 20 '07 #1
3 1228
HI

I highly recomend using stored procedures
read more about them in

Creating Stored Procedures (Database Engine)
http://msdn2.microsoft.com/en-us/library/ms190669.aspx

-----------------------------
If my answer helped you please press "Yes" bellow

Adlai Maschiach
http://blogs.microsoft.co.il/blogs/adlaim/
"Simone" wrote:
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

Mar 21 '07 #2
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
"Simone" <oi****@hotmail.comwrote in message
news:11**********************@b75g2000hsg.googlegr oups.com...
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

Mar 21 '07 #3
On Mar 21, 4:43 am, "Eliyahu Goldin"
<REMOVEALLCAPITALSeEgGoldD...@mMvVpPsS.orgwrote:
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

"Simone" <oim...@hotmail.comwrote in message

news:11**********************@b75g2000hsg.googlegr oups.com...
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- 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.

Mar 21 '07 #4

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

Similar topics

9
by: pescott | last post by:
Hello people, I could really use your help on this one... I have script to upload image data to a database, but all that is uploaded is the decription, not the data BLOB itself. There must be...
2
by: Jo Voordeckers | last post by:
Hello all, I'm pretty new to the Java newsgroups so I apologize for dropping this into several maybe offtopic groups. I'm sorry! So on to my problem... I've come to a point in our RMI...
2
by: Steve D | last post by:
I've looked all over but can't find a solid answer. I've got a function that runs from a View and when the function runs the first time it is calculating a Temperature for a group of Formulas. ...
9
by: Alan | last post by:
Using VC++ (1998) compiler with PFE32 editor in Win2K Pro SP4. (DigitalMars CD on order. ) The program (below) instantiates a class and then deletes it. I would have thought that reusing the...
11
by: bissatch | last post by:
Hi, I am trying to upload an image, create a new file based on that image and then store the base64 encoded image data in a database. I dont really know where my code is going wrong so I will...
4
by: Old Wolf | last post by:
#include <stdio.h> #include <stdarg.h> Is this safe: void foo(const char *fmt, ...) { va_list ap; va_start(ap,fmt);
17
by: | last post by:
I have an app that retrieves data from an Access database. At the moment I have the SQL string as a Const in my app. I understand this is not best practice. I don't want the user to have access to...
5
by: Demetri | last post by:
Unfortunately, where I work it is forbidden to use stored procedures. I know, I know...it's pretty stupid. But I can not change that. Anyway, currently we have our sql stored in an embedded resx...
7
by: grbeltran | last post by:
Hey everybody, I am having lots of trouble storing values in an array and I want to be prompt at the beginning of each value. The values I will enter will be two digit values such as 23, or 42,...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
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,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.