Welcome to Dream.In.Code
Getting Help is Easy!

Join 105,763 Programmers for FREE! Ask your question and get quick answers from experts. There are 1,676 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



SQL statement in asp.net/vb

 
Reply to this topicStart new topic

SQL statement in asp.net/vb

andiyuniar
post 27 Apr, 2008 - 09:26 PM
Post #1


New D.I.C Head

*
Joined: 15 Apr, 2007
Posts: 25


My Contributions


Hi there...

I have a question about query string.

I created web application using asp.net/vb.
In my application, i used an oracle 10g database.

I create a procedure to save or update database. User can input a data in textbox, and then
i use this "textbox.text" and combine with query string to process to database.

But, there is a problem, when data that inputed by user has a special char like aposthrope ('), an error message will show "ORA-01756: quoted string not properly terminated."

How to solve this problem? is there a way to allow the special char like (') in query?
Like "prepare statement" in jsp (i think)


thanks
User is offlineProfile CardPM

Go to the top of the page


PsychoCoder
post 27 Apr, 2008 - 10:19 PM
Post #2


DIC.Rules == true;

Group Icon
Joined: 26 Jul, 2007
Posts: 7,030



Thanked 47 times

Dream Kudos: 7600

Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, GDI

My Contributions


Before you pass the value into the QueryString replace the single quote with two of them


vb

TextBox1.Text.Replace("'","''")
User is online!Profile CardPM

Go to the top of the page

thor78
post 6 May, 2008 - 06:04 PM
Post #3


D.I.C Head

Group Icon
Joined: 6 May, 2008
Posts: 104



Dream Kudos: 50
My Contributions


You can try:

CODE

Server.HtmlEncode(StringVar);


This encodes special characters like ', <, >, and even HTML tags to explicitly output the characters as is.
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 8/21/08 01:51PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month