Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old August 2nd, 2005, 02:25 PM
Authorized User
 
Join Date: Jul 2005
Location: New York, New York, .
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
Default Input is okay for ADO?

I have a textarea that is inserted to database(via ado). Sometimes, the insert statement doesn't get executed. I wonder if it has something to do with weird characters such as "'%$. So I use Server.URLEncode the textarea content. But it doesn't solve all situations.

Any other reason can be the cause ? Thank you.

  #2 (permalink)  
Old August 2nd, 2005, 06:03 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

;;;Sometimes, the insert statement doesn't get executed
What exactly are the behaviours, error??

;;;I wonder if it has something to do with weird characters
If you are not handling wierd charcters, then yes probably. Trial and error will tell you, have you tryed this?

Try this function on insert:
  Function StoreText(theText)
    StoreText = ""
    on error resume next
    StoreText = CStr(theText)
    if (len(StoreText) > 0) Then
      StoreText = Replace(StoreText, """", """, 1, -1, 1)
      StoreText = Replace(StoreText, "'", "''", 1, -1, 1)
      StoreText = Replace(StoreText, vbCrLf, "<BR>", 1, -1, 1)
    end if
  End Function

Use it like so:
storeText(trim(request.form("yourFieldName")))

Wind is your friend
Matt
  #3 (permalink)  
Old August 4th, 2005, 01:39 PM
Authorized User
 
Join Date: Jul 2005
Location: New York, New York, .
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I tried that function. But it does not solve the issue.
If the input is a double quote, how to handle that?

When I pass that sql statement(with quote), it does not work.

dbConn.Execute sqlStatement ' this won't work

  #4 (permalink)  
Old August 4th, 2005, 05:56 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

As I said - "What exactly are the behaviours, error??"

;;If the input is a double quote, how to handle that?
This part of the function handles that (yes it does work):
StoreText = Replace(StoreText, """", "&quot;", 1, -1, 1)

comment out the execute line, print your statement to the browser and post it for a solution. Do you use SQL Server? If so open query analyser, run your query - what is the error?

Wind is your friend
Matt


Similar Threads
Thread Thread Starter Forum Replies Last Post
Difference between ADO and ADO.NET rakeshclose2u ADO.NET 2 April 23rd, 2007 03:57 AM
How to take input !!!!! CodeMaker C# 4 January 7th, 2005 11:34 AM
Input validation shs BOOK: Beginning ASP.NET 1.0 14 January 6th, 2005 01:03 PM
ADO AND ADO.NET royalsurej ADO.NET 1 November 8th, 2004 08:28 AM
ADO could ADO counot find the specified provider. Rob Collie Classic ASP Databases 2 June 9th, 2003 04:12 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.