Re: Could not convert variant of type (Null) into type (String)
- From: "Betsy" <betsy.a.tainer@xxxxxxxxxxxxx>
- Date: Mon, 11 Apr 2005 16:25:57 -0700
My English is pretty bad too... being American!! (tee hee)
I've seen this error SO many times... trying to pin down exactly where I've
seen it is turning out to be the difficulty...
I think that it all stemmed from my misperception that '' and <NULL> were
the same thing... they are NOT NOT NOT... (that lesson caused me a lot of
pain)
check these points:
-If you are setting a field in you SQL database which is requiring a string
be sure that you are in fact giving it a string and not a NULL/NIL value
-If you are feeding it an empty string '' where you intend for it to be
<NULL> the best way I've found is to us adotbl.fieldreference.CLEAR; (just
found it, love it)
-If you are are using a query with a where clause and trying to find a ''
(blank) value by using where field='' use where field IS NULL instead...
(but then be sure and use CLEAR (above) so you aren't missing some intended
records in your result set... although I don't think this would cause your
error it is along the same thought process of null vs ''
Working through these issues I found it useful to watch the database
directly while testing the application to watch for individual results to
changes and insertions just to make certain that I was getting the result
that I was expecting.
Hope that helps.
b
"zorba" <tjall@xxxxxxxxxxxx> wrote in message
news:421e3217@xxxxxxxxxxxxxxxxxxxxxxxxx
> I connect with SQL Server(MSDE) database using ADO(Microsoft OLE DB
> Provider for ODBC Drivers).Durnig compilation occured exception "Could
> not convert variant of type (Null) into type (String)". What's causing
> that problem?
>
> Sorry for my English :)
>
>
>
> --- posted by geoForum on http://delphi.newswhat.com
.
- Prev by Date: Re: TADOStoredProc Problem - Insert Proc duplicating data???
- Next by Date: Re: ADOQuery slow
- Previous by thread: ExecSQL result
- Next by thread: Re: ADOQuery slow
- Index(es):
Relevant Pages
|