Thread View: comp.lang.perl.misc
6 messages
6 total messages
Started by Yossi Konijn
Thu, 24 Oct 1996 00:00
Another ODBC/SQL question
Author: Yossi Konijn
Date: Thu, 24 Oct 1996 00:00
Date: Thu, 24 Oct 1996 00:00
38 lines
1825 bytes
1825 bytes
Hi all, Since last time this group was of great help, I'll try my luck again. I'm using ODBC.PL to connect to Access 7.0. I have no problems sending INSERTand SELECT SQL commands, but the update appears not to give the proper result. This is the command I'm sending: UPDATE ServiceRecords SET QueryID = '144', CustomerID='123456789012345', EmployeeID='YossiK', ServiceDate = '24/10/96', ServiceTime = 'ServiceTime', ProductVersion = '2.0', ServiceRecords.ProductName='Dagesh', ServiceRecords.Status='ON', ServiceRecords.AnswerDescription='goodbye', ServiceRecords.ProblemDescription='hello again?', ServiceRecords.Version='2.0' WHERE QueryID='144'; And the error message I'm receiving is: [Microsoft][ODBC Microsoft Access 7.0 Driver] Too few parameters. Expected 2 The only other relevent thing is that QueryID is an Access generated field that increments by 1 every time a new entry is entered. Any advice will be appreciated. If possible please use mail, the newsgroup server isn't that good. Oh, and while on the subject, does anyone know what escape sequence I should use to send a single-quote to a text field? I'm trying to type 'Can't' but the quotes are confusing Access. Thanks, Yossi
Re: Another ODBC/SQL question
Author: Yossi Konijn
Date: Thu, 24 Oct 1996 00:00
Date: Thu, 24 Oct 1996 00:00
32 lines
1672 bytes
1672 bytes
Ok, I solved the first problem, it was a problem that ServiceRecords.Status='ON' only receives 1 and 0 and QueryId should be compared to a number without the quotes. Still waiting fo help on number 2 (entering a single quote in a text field using SQL). Thanks, Yossi On Thu, 24 Oct 1996 11:53:41 GMT, yossik@accentsoft.com (Yossi Konijn) wrote: >Hi all, > >Since last time this group was of great help, I'll try my luck again. >I'm using ODBC.PL to connect to Access 7.0. I have no problems sending >INSERTand SELECT SQL commands, but the update appears not to give the >proper result. This is the command I'm sending: > >UPDATE ServiceRecords >SET >QueryID = '144', CustomerID='123456789012345', >EmployeeID='YossiK', ServiceDate = '24/10/96', ServiceTime = . . . >Oh, and while on the subject, does anyone know what escape sequence I >should use to send a single-quote to a text field? I'm trying to type >'Can't' but the quotes are confusing Access.
Re: Another ODBC/SQL question
Author: Glenn Stanton
Date: Fri, 25 Oct 1996 00:00
Date: Fri, 25 Oct 1996 00:00
21 lines
1523 bytes
1523 bytes
Yossi Konijn wrote: >> Oh, and while on the subject, does anyone know what >> escape sequence I should use to send a single-quote >> to a text field? I'm trying to type 'Can't' but the >> quotes are confusing Access. it seems to be a real problem for the ODBC "JetEngine". Since most of my work involves the WWW I simply replace them with an ISO equiv. value which is rendered as a single quote: $somevar =~ s/\'/\&\#146\;/g; obviously this isn't the solution for non-WWW results. for reports I have a script that simply reverses this (and some other stuff...) -- /////////////////////////////////////////////////////////// // Glenn Stanton gms@lucent.com
Re: Another ODBC/SQL question
Author: Dave Roth
Date: Sat, 26 Oct 1996 00:00
Date: Sat, 26 Oct 1996 00:00
38 lines
2011 bytes
2011 bytes
In article <54nomb$j88@news.NetVision.net.il> yossik@accentsoft.com (Yossi Konijn) wrote: To start with the easy question: To include single quotes use the apostrophe (aka single quote) escape char so you would say the following: Field1 = 'Can''t' > UPDATE ServiceRecords > SET > QueryID = '144', CustomerID='123456789012345', > EmployeeID='YossiK', ServiceDate = '24/10/96', ServiceTime = > 'ServiceTime', ProductVersion = '2.0', > ServiceRecords.ProductName='Dagesh', ServiceRecords.Status='ON', > ServiceRecords.AnswerDescription='goodbye', > ServiceRecords.ProblemDescription='hello again?', > ServiceRecords.Version='2.0' > WHERE > QueryID='144'; This looks okay without spending tons o time lookat it. Try using Access to check out the SQL. dave ================================================================ Dave Roth ...glittering prizes and Roth Consulting endless compromises, shatter rothd@roth.net the illusion of integrity **************************************************************** Use of this message or email address for commercial purposes (including "junk" mailings) is strictly prohibited and protected under current international copyright laws and United States Code, Title 47, Chapter 5, Subchapter II.
Re: Another ODBC/SQL question
Author: Mark D. Mills
Date: Mon, 28 Oct 1996 00:00
Date: Mon, 28 Oct 1996 00:00
25 lines
1549 bytes
1549 bytes
On Fri, 25 Oct 1996 09:08:54 -0400, Glenn Stanton <gms@lucent.com> wrote: >Yossi Konijn wrote: >>> Oh, and while on the subject, does anyone know what >>> escape sequence I should use to send a single-quote >>> to a text field? I'm trying to type 'Can't' but the >>> quotes are confusing Access. >it seems to be a real problem for the ODBC "JetEngine". >$somevar =~ s/\'/\&\#146\;/g; >obviously this isn't the solution for non-WWW results. I may have mentioned this in a prior post. From what I've seen of SQL it allows you to quote out the characters the same way C, shells, and perl do. Backslash 'em. I use: $somevar =~ s/\'/\\\'/g; or $somevar =~ s/\'/\\\\\\\'/g; depending on how many times it is interpeted. (actually $somevar =~ s#\'#\\\'#g; will prevent blindness :> ) HTH Mark <insert sig <insert 'don't sue my boss' disclaimer here> here>
Re: Another ODBC/SQL question
Author: Glenn Euloth
Date: Wed, 30 Oct 1996 00:00
Date: Wed, 30 Oct 1996 00:00
17 lines
1261 bytes
1261 bytes
In article <32719a0a.23151825@news.netvision.net.il>, yossik@accentsoft.com says... > >Ok, I solved the first problem, it was a problem that >ServiceRecords.Status='ON' only receives 1 and 0 and QueryId should be >compared to a number without the quotes. > >Still waiting fo help on number 2 (entering a single quote in a text >field using SQL). > One solution I found, not perl specific but SQL specific, and I haven't tried it in perl is to double up the single quote. ie: INSERT INTO TABLE test (last_name = 'O''Brien'); Good Luck
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads