Article View: borland.public.cppbuilder.database.ado
Article #5372Re: Empty String Parameters are Illegal in ADO?
From: Arnie Mauer
Date: Wed, 13 Jun 2001 13:41
Date: Wed, 13 Jun 2001 13:41
126 lines
5411 bytes
5411 bytes
Thanks for the suggesstions. Actually, we're not having an Oracle problem - yet. The error message: "Parameter object is improperly defined. Inconsistent or incomplete information was provided." Seems to be either an exception or assertion generated either in ADO or ADOExpress. I get the same message regardless of whether I use the MS or Oracle OLEDB provider. We really couldn't implement your solution at this point. We have maybe 10,000-15,000 lines of C++ code with SQL. What we are doing is switching from BDE to ADO - that's bad enough! Thanks again, -Arnie "BM" <m02x7z00@cwcom.net> wrote in message news:3b25fd36_2@dnews... > Hi again, > > Do you get a ORA-01036? > > Actually looking back at the code we had loads of problems with Oracle's > OLEDB driver (and the alternatives had problems of there own so not much > point changing). Do you get a ORA-01036. What we did to get over this > problem dynamically write the SQL so that if a value is null you explicitly > set it to NULL in the SQL statement. > > i.e. your final SQL should look something like ... > > INSERT INTO MYTABLE (COL1, COL2, COL3) VALUES(:COL1, NULL, :COL3) > > This implementation probably calls for an object (or record structure) to > hold the column names associated with your table. > > This means that in your code you would of looped through your columns of > your object and found that > 1. the value for COL1 was not NULL so you set-up a :COL1 parameter > placeholder which you set the value of later > 2. the value for COL2 was NULL so you use set it explicitly as NULL > 3. the value for COL3 was not NULL so you set-up a :COL3 parameter > placeholder which you set the value of later > > Furthermore as you are now dynamically writing the SQL we also found you > need to set the Parameter type property. > Param.ParameterObject.Type_ := COL1.ColumnType > > So it also means that you will need to store away the fieldtype(column type) > of each column in your table so that you can set this value which we did > after the parameter's value had been set. If your using Oracle you can look > this up before hand using USER_TABLES views. > > > Hope this helps > > Let us know if resolves the problems you were having. > > P.S. If your planning to insert into TEXTBLOBS let us know as we've > implemented a workaround for this to. > > FrontMan Solutions Ltd > > Independent Software Consulting > mailto:Services.FrontManSolutions@ic24.net > > > > Arnie Mauer <arnie@marketexpert.com> wrote in message > news:3b24b35d$1_1@dnews... > > Hmmm. Interesting. But, it doesn't work. > > > > BTW, using the Oracle OLE DB provider. > > > > When I assign NULL, the TParameter Value is 0 and the Size is -1. On an > > INSERT, it actually puts a "0" into the table column. I really want an > > empty > > value, not zero. However, I found that when I assign a NULL AnsiString or > > empty C string and then set the TParameter Size to -1, it seems to give > > the desired result. It seems unhappy only when the Size is zero. > > > > "BM" <m02x7z00@cwcom.net> wrote in message news:3b23a7eb_2@dnews... > > > First of all I'm more familiar to Delphi so I apologies for any > > > discrepancies. > > > Can't tell you why these things happen but from our experience if you > have > > a > > > NULL string you must set the parameter to NULL (i.e check its a blank > > > string- if it is set Parameter.Value = NULL) otherwise you see this > error. > > > Another advisable thing to do is initialise all parameters to NULL i.e. > > > before any parameters are set is loop through them and set their value > to > > > NULL. > > > > > > BM > > > > > > > > > Arnie Mauer <arnie@marketexpert.com> wrote in message > > > news:3b20ed67_2@dnews... > > > > In a parameterized INSERT statement in a TADOQuery, when setting > > > > q->Parameters->ParamByName( "foo" )->Value = ""; > > > > will cause q->ExecSQL() to throw an excpetion of: "Parameter object is > > > > improperly defined. Inconsistent or incomplete information > > > > was provided." Same goes for a NULL AnsiString. > > > > > > > > The TParameter Value == NULL and Length == 0. The DataType > > > > has been properly set to ftString after the assignment. What's > > > > wrong with a NULL string? > > > > > > > > > > > > > > > > > > > >
Technical Details
Message-ID:
<3b276d7d$1_2@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!ihug.co.nz!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnewsReferences:
<3b20ed67_2@dnews> <3b23a7eb_2@dnews> <3b24b35d$1_1@dnews> <3b25fd36_2@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,bf8db65ec424c3c9 X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2001-06-13 06:42:39 PST From: "Arnie Mauer" <arnie@marketexpert.com> Newsgroups: borland.public.cppbuilder.database.ado References: <3b20ed67_2@dnews> <3b23a7eb_2@dnews> <3b24b35d$1_1@dnews> <3b25fd36_2@dnews> Subject: Re: Empty String Parameters are Illegal in ADO? Date: Wed, 13 Jun 2001 09:41:31 -0400 Lines: 128 Organization: VRMS X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 NNTP-Posting-Host: 209.140.211.97 Message-ID: <3b276d7d$1_2@dnews> X-Trace: dnews 992439677 209.140.211.97 (13 Jun 2001 06:41:17 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!ihug.co.nz!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews