Solved

ASP.net Insert Parameter Query

Posted on 2011-03-13
2
330 Views
Last Modified: 2012-05-11
What would the INSERT equivalent of the following ASP.net 4 parameter query be in a table adapter. See code below
SELECT        ID, School, [User], [Start date], [Start time], [End date], [End time], House, Form, [Subject or activity], [Age group], [Sport or activity], Other, [Use]
FROM            Table1
WHERE        (School = @Parameter1) AND ([User] = @Parameter2) AND (House = @Parameter3) AND (Form = @Parameter4) AND ([Subject or activity] = @Parameter5) AND 
                         ([Age group] = @Parameter6) AND ([Sport or activity] = @Parameter7) AND (Other LIKE @Parameter8)

Open in new window

0
Comment
Question by:murbro
2 Comments
 
LVL 11

Accepted Solution

by:
SAMIR BHOGAYTA earned 500 total points
ID: 35125482
Hi, Read the following things

There are two compelling reasons everyone should learn about Parameterized Queries. One entails one keyboard character and is more of a hassle reliever than anything else. That character, in code, can become either of two different objects, the single quote and the apostrophe. When you’re coding, either one can make your life truely miserable at times. The second, and MOST compelling reason to learn Parameterized Queries is to protect your database from SQL Injection Injection Attacks. If you have never heard of them, youneed to hear about them now. These attacks can reak havoc on your server and, more importantly, your data. Check out these articles on SQL Injection Attacks:

http://msdn.microsoft.com/msdnmag/issues/04/09/SQLInjection/
http://www.tech-faq.com/sql-injection-attack.shtml

Protecting Your ASP.NET from SQL Injection attacks
Simply by using Parameterized Queries, this becomes a first line of defense, and SQL Injection attacks are stopped in their tracks.

Anyone who has ever put together a long, involved SQL statement with variables, juggling single quotes, along with the double quotes (Tutorial on Single and Double Quotes), will tell you that it’s not much fun. And – on top of that, when we then talk about the apostrophe, it gets even more complicated.
0
 

Author Closing Comment

by:murbro
ID: 35166625
thanks very much
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now