DeveloperBarn Forums

Go Back   DeveloperBarn Forums > Databases > SQL Development

Discuss "special characters" in the SQL Development forum.

SQL Development - Structured Query Language (SQL) is the talk of databases. Discuss topics such as joins, triggers and other advanced SQL topics.


Closed Thread « Previous Thread | Next Thread »  
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old May 21st, 2008, 10:31 AM
New Member

 
Join Date: Apr 2008
Posts: 21
Thanks: 0
Thanked 1 Time in 1 Post
Rep Power: 1
Jaykappy is an unknown quantity at this point
Default special characters

I have a few tables in SQL Server, an ODBC link set up on my computer, and an Access Database front end.

In my form I am populating textboxes from another database and a few of the values have Apostrophes in them '.....my SQL INSERT INTO statement is not working on the records that have Apostrophes...

The fields in the SQL database are text fields....Is there anything that I can do to get the SQL update to work? Syntax wise?

Of do I have to go through an remove the Apostrophes' and periods . etc

THis is an example of the textbox value:
Kingston's Meadow

This is the code I am using...

THANKS


Code:
varName = Text82
varOwners_Residence = Text84
varNotice_Expiration = cbo_94
varNotes = Text104
varNotice_Number = Text80
varStatus = Text88
'varResides = ""
'varturn_in = ""
varNotice_Date = cbo_92
varProperty_Address = Text86
varNuisance_Type = Combo98
varAddition_Name = Addition_Name
varRange = Range
varLot = Lot
varBlock = Block
varZip_Code = Zip_Code
varDisplay_PID = PID
varSec_tion = Sec_tion
varTownship = Township
varProperty_City = Text106
varProperty_State = Text108
varProperty_Zip = Text110

varPictureID = Text160
varPicturePath = "\\weeds_database\Weeds_Database_Images\"

varOwner_City = Text194
varOwner_State = Combo202
varOwner_Zip = Text196


Dim varID As Integer
varID = Val(DMax("ID", "dbo_data")) + 1
'MsgBox varID

'===============================================
'===============================================

Dim MySQL As String

MySQL = ""

'MySQL = "INSERT INTO tbl_TRAINING (VendorNumber, FirstName, LastName, Dates, TimeLength, Type, Hours, Experienced_Judge, Attended) values ('" & varVendorNumber & "', '" & varFirstName & "', '" & varLastName & "', '" & varDates & "', '" & varTime & "', '" & varType & "', '" & varHours & "', '" & varExperiencedCheck & "','" & varAttendedCheck & "');"
MySQL = "INSERT INTO dbo_data ("
MySQL = MySQL & "ID,Name,Owners_Residence,Notice_Expiration,Notes,Notice_Number,Status,Notice_Date,Property_Address,Nuisance_Type,Addition_Name,Range,Lot,Block,Zip_Code,Display_PID,Sec_tion,Township,Property_City,Property_State,Property_Zip,PictureID,PicturePath,Owner_City,Owner_State,Owner_Zip"
MySQL = MySQL & ") values ("
MySQL = MySQL & "'" & varID & "','" & varName & "','" & varOwners_Residence & "','" & varNotice_Expiration & "','" & varNotes & "','" & varNotice_Number & "','" & varStatus & "','" & varNotice_Date & "','" & varProperty_Address & "','" & varNuisance_Type & "','" & varAddition_Name & "','" & varRange & "','" & varLot & "','" & varBlock & "','" & varProperty_Zip & "','" & varDisplay_PID & "','" & varSec_tion & "','" & varTownship & "','" & varProperty_City & "','" & varProperty_State & "','" & varZip_Code & "','" & varPictureID & "','" & UpdateFullPath & "','" & varOwner_City & "','" & varOwner_State & "','" & varOwner_Zip & "'"
MySQL = MySQL & ");"

DoCmd.SetWarnings False
'MsgBox MySQL
DoCmd.RunSQL MySQL
Sponsored Links
  #2 (permalink)  
Old May 21st, 2008, 10:50 AM
New Member

 
Join Date: Apr 2008
Posts: 21
Thanks: 0
Thanked 1 Time in 1 Post
Rep Power: 1
Jaykappy is an unknown quantity at this point
Default

Got it...from another forum......just did this on each variable....

varName = Replace(Text82,"'","''")
Closed Thread

  DeveloperBarn Forums > Databases > SQL Development

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


Sponsored Links

ASP.NET Resource Index
a directory of ASP.NET tutorials, applications, scripts, assemblies and articles for the novice to professional developer.

Free Web Directory
Including Chats and Forums Resources, Offer automatic, instant and free directory submissions.
URLZ Web Directory
URLZ Web Directory

Free Web Directory - Add Your Link
The Little Web Directory
Free Web Directory
Pegasus free web directory is a free directory organised by categories.

Web Directory & SEO Services
dirroot web directory


All times are GMT -4. The time now is 08:49 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0
Copyright © 2008 DeveloperBarn.com

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46