🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.database.ado
6 messages
6 total messages Started by Kura Fri, 13 Jan 2006 10:34
'Could not convert variant of type (Null) into type (String)'
#634
Author: Kura
Date: Fri, 13 Jan 2006 10:34
20 lines
1676 bytes
In borland C++ builder 6 I add ADOTable and set up
ConnectionString on value:
Provider=MSDASQL.1;Password=masterkey;Persist Security Info=True;User
ID=sysdba;Data Source=ConnectFbServer;Mode=ReadWrite


I connecting with Firebird, I have OLE DB driver from
Firebird website.


In propertise for ADOTable  "table name" I choose my table,and set active on 
true
When i compiling the program i get an exception:
Project "Name.exe" raised exception class EVariantTypeCastError with
message 'Could not convert variant of type (Null) into type (String)'.


I don`t have any others components then Form and ADOTable.

I'll be greatfull for any suggestions.(Sory for my Englisch!)
Re: 'Could not convert variant of type (Null) into type (String)'
#635
Author: Mike Shkolnik
Date: Fri, 13 Jan 2006 14:02
36 lines
2066 bytes
Somewhere in your code you read the Value property for field and applied to
AnsiString variable.
Just use the AsString for your field instead Value and no error will be
raised

--
With best regards, Mike Shkolnik
EMail: mshkolnik@scalabium.com
http://www.scalabium.com

"Kura" <kurakusmaximus@poczta.onet.pl> wrote in message
news:43c78184@newsgroups.borland.com...
> In borland C++ builder 6 I add ADOTable and set up
> ConnectionString on value:
> Provider=MSDASQL.1;Password=masterkey;Persist Security Info=True;User
> ID=sysdba;Data Source=ConnectFbServer;Mode=ReadWrite
>
>
> I connecting with Firebird, I have OLE DB driver from
> Firebird website.
>
>
> In propertise for ADOTable  "table name" I choose my table,and set active
on
> true
> When i compiling the program i get an exception:
> Project "Name.exe" raised exception class EVariantTypeCastError with
> message 'Could not convert variant of type (Null) into type (String)'.
>
>
> I don`t have any others components then Form and ADOTable.
>
> I'll be greatfull for any suggestions.(Sory for my Englisch!)
>
>
>
Re: 'Could not convert variant of type (Null) into type (String)'
#636
Author: Kura
Date: Fri, 13 Jan 2006 14:12
16 lines
1708 bytes
The point is , that I haven`t any code. I just put component ADOTable on 
empty form, and use "Build" button in window of property "ConnectionString" 
to create connection atributes.
????
U�ytkownik "Mike Shkolnik" <mshkolnik2002@ukr.net> napisa� w wiadomo�ci 
news:43c7b22c@newsgroups.borland.com...
> Somewhere in your code you read the Value property for field and applied 
> to
> AnsiString variable.
> Just use the AsString for your field instead Value and no error will be
> raised
>
> --
> With best regards, Mike Shkolnik
> EMail: mshkolnik@scalabium.com
> http://www.scalabium.com
Re: 'Could not convert variant of type (Null) into type (String)'
#637
Author: Vladimir Stefanovic
Date: Fri, 13 Jan 2006 14:19
19 lines
1432 bytes
Add *all* the tabels' fields to the header.

How?

Double click on every (design time) TADOTable icon you have,
and then a small window will appear. Then, find a way to:
"Add all filelds..." (or something similar).

BUILD ALL.

P.S.

Please let us know if that works...



-- 
Best regards,
Vladimir Stefanovic 
Re: 'Could not convert variant of type (Null) into type (String)'
#638
Author: Kura
Date: Fri, 13 Jan 2006 16:41
19 lines
1668 bytes
Thanks a lot. It`s works.Thank you, thank you, thank you;-).
Now I have next question about it.What`s the name of property where i adding 
all fields from my table(just like tou say)?How I can do it from application 
code?Any function or somethink?
Once again thanks awfull!
>"Vladimir Stefanovic" wrote:
> Add *all* the tabels' fields to the header.
>
> How?
>
> Double click on every (design time) TADOTable icon you have,
> and then a small window will appear. Then, find a way to:
> "Add all filelds..." (or something similar).
>
> BUILD ALL.
>
> P.S.
>
> Please let us know if that works...
Re: 'Could not convert variant of type (Null) into type (String)'
#639
Author: Vladimir Stefanovic
Date: Fri, 13 Jan 2006 17:04
46 lines
2064 bytes
> Thanks a lot. It`s works.Thank you, thank you,
> thank you;-).

Great :)


> What`s the name of property where i adding all fields
> from my table(just like tou say)?

Sorry, can you be more speciffic?

(You just add the fields at design-time, and you do not need
anything else with them at run-time)

In fact you can make an app without adding those fields at all
but you may experience some difficulties, as you already noticed.


> How I can do it from application code?Any function or
> somethink?

Why do you need that?

I suppose that you can do something like this:

--- example from BCB6 help (for SQLDataSet, but must be the
similar for ADO) ---

SQLDataSet1->Close();

TFloatField *T = new TFloatField(SQLDataSet1);
T->Precision = 2;
T->FieldName = "Amount";
T->Name = SQLDataSet1->Name + T->FieldName;
T->Index = SQLDataSet1->FieldCount;
T->DataSet = SQLDataSet1;
SQLDataSet1->FieldDefs->UpDate();
SQLDataSet1->Open();

But yiu do not need that at all.



-- 
Best regards,
Vladimir Stefanovic 
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