Board index » delphi » ADOTable open - error: Invalid variant type conversion.

ADOTable open - error: Invalid variant type conversion.

Hi,
Someone please help me to solve my problem.
I would like to connect to a MSDE database's table. But when i
connect using ADOTable.Open, it gives me error - Invalid Variant
type conversion. the following is my code:-

  ADOTable1.Connection:=ADOConnection1;
  ADOConnection1.ConnectionString:='Provider=MSDASQL.1;'+
                                   'Persist Security info=False;'+
                                   'User ID='sa';'+
                                   'User Password='';'+
                                   'Data Source=ABC;'+
                                   'Mode=Read;'+
                                   'Initial Catalog=EsofLAN';
  ADOConnection1.LoginPrompt:=false;
  ADOConnection1.open;
  ADOTable1.TableName:='XYZ';
  ADOTable1.Open;

  I know there must be something wrong with my script. Please
  correct me.

  Thanks in advance.

  sam

 

Re:ADOTable open - error: Invalid variant type conversion.


Hi,
I have solve the problem. It is because i didn't put 'dbo.'
in front of the table name.

Thanks.

sam

Quote
"sam" <samuell...@hotmail.com> wrote:

>Hi,
>Someone please help me to solve my problem.
>I would like to connect to a MSDE database's table. But when i
>connect using ADOTable.Open, it gives me error - Invalid Variant
>type conversion. the following is my code:-

>  ADOTable1.Connection:=ADOConnection1;
>  ADOConnection1.ConnectionString:='Provider=MSDASQL.1;'+
>                                   'Persist Security info=False;'+
>                                   'User ID='sa';'+
>                                   'User Password='';'+
>                                   'Data Source=ABC;'+
>                                   'Mode=Read;'+
>                                   'Initial Catalog=EsofLAN';
>  ADOConnection1.LoginPrompt:=false;
>  ADOConnection1.open;
>  ADOTable1.TableName:='XYZ';
>  ADOTable1.Open;

>  I know there must be something wrong with my script. Please
>  correct me.

>  Thanks in advance.

>  sam

Re:ADOTable open - error: Invalid variant type conversion.


Sam,

  If your using table-based components against a set-based server, your
going to run into a lot more issues.

Before you run into the inherent problems with desktop DB app design in a
client/server environment check out...
http://bdn.borland.com/article/0,1410,28160,00.html

Good luck,
krf

Quote
"sam" <samuell...@hotmail.com> wrote in message

news:3ed6fe4d$1@newsgroups.borland.com...
Quote

> Hi,
> I have solve the problem. It is because i didn't put 'dbo.'
> in front of the table name.

> Thanks.

> sam

Other Threads