473,325 Members | 2,805 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,325 software developers and data experts.

Query Parameters

Hi,

I am using Microsoft Application Blocks and I have the following query.

//save the data
insertSQL = "INSERT INTO Table1 VALUES (" + unixTime + "," + CCR + ","
+ CCT + "," + CCT + ",'" + completedBy + "','" + id + "',100, 'test',
'test')";

SqlHelper.ExecuteNonQuery (objConnect, CommandType.Text, insertSQL);

Is there anyway to break up the above so it is cleaner and I just pass
the parameters instead of building the query? The above does do the
work but is not cleaner and I need to use the same query somewhere else
too.

Thanks for the help
Shahid

Nov 19 '05 #1
1 883
"Shahid Juma" <sh*********@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
Hi,

I am using Microsoft Application Blocks and I have the following query.

//save the data
insertSQL = "INSERT INTO Table1 VALUES (" + unixTime + "," + CCR + ","
+ CCT + "," + CCT + ",'" + completedBy + "','" + id + "',100, 'test',
'test')";

SqlHelper.ExecuteNonQuery (objConnect, CommandType.Text, insertSQL);

Is there anyway to break up the above so it is cleaner and I just pass
the parameters instead of building the query? The above does do the


This doesn't really answer your questions, but in case you don't know,
THIS IS VER DANGEROUS IN A WEBAPP.

Go google "SQL Injection Attack"

Then use either a stored procedure or a parameterized query. You'll add
lines of code, but you'll sleep better knowing you aren't going to get sued
for incompetence. ;)

Regards,
John
Nov 19 '05 #2

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

Similar topics

3
by: Ryan Hubbard | last post by:
I would like to run a query from VBA. The query will be one with parameters. Is there a way to run the query and have Access prompt for the values like it does if I where to execute it through...
15
by: Richard Hollenbeck | last post by:
I tried to ask this question before on the 14th of January but I never got a reply. I'm still struggling with the problem. I'll try to rephrase the question: I have a crosstab query with rows...
9
by: Kelii | last post by:
I've been trying to get this piece to work for a few hours, but have given up. I hope someone out there can help, I think the issue is relatively straightforward, but being a novice, I'm stumped....
3
by: Richard Hollenbeck | last post by:
I am very sorry about the (almost) re-post, but you will see that my first question wasn't very clear; I have another question I posted this morning called, "in DAO: Run time error 3061 Too few...
8
HaLo2FrEeEk
by: HaLo2FrEeEk | last post by:
I'd like to write a program to assist me in upoloading files to my site. I know how to upload the files using C#, I just don't know how to have an interface and still accept commandline parameters. ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.