Connecting Tech Pros Worldwide Help | Site Map

ADO Question

 
LinkBack Thread Tools Search this Thread
  #1  
Old November 12th, 2005, 03:00 PM
Uttam
Guest
 
Posts: n/a
Default ADO Question

Hello,

I have an array from which I load values into a table.

My table creation is done using ADO.

Some of the fields in the Array can have null values and I want to
load the corresponding table field with the same values as in the
array - that is null or non-null values.

I have defined text fields in ADO in table creation as follows:

With tbl
..Name = "tbl_Name"
Set .ParentCatalog = cat
..Columns.Append "Case_Field", adWChar
End With

When the array contains null values I get a message saying "You tried
to assign a Null Value for a variable that is not Variant Data Type"

What should I change in the above code in order that this message does
not appear?

Thanks in advance.

Uttam

  #2  
Old November 12th, 2005, 03:01 PM
Tom van Stiphout
Guest
 
Posts: n/a
Default Re: ADO Question

On 2 Nov 2003 17:12:22 -0800, u0107@hotmail.com (Uttam) wrote:

Are you SURE the error occurs in this code fragment? Make sure, by
setting a breakpoint and stepping through.

Rather I would think the bug is in the assignment of the array. For
example this code would fail:

dim v as variant
dim s(10) as string 'string array
v=null
s(0) = v 'error here.

-Tom.

[color=blue]
>Hello,
>
>I have an array from which I load values into a table.
>
>My table creation is done using ADO.
>
>Some of the fields in the Array can have null values and I want to
>load the corresponding table field with the same values as in the
>array - that is null or non-null values.
>
>I have defined text fields in ADO in table creation as follows:
>
>With tbl
>.Name = "tbl_Name"
>Set .ParentCatalog = cat
>.Columns.Append "Case_Field", adWChar
>End With
>
>When the array contains null values I get a message saying "You tried
>to assign a Null Value for a variable that is not Variant Data Type"
>
>What should I change in the above code in order that this message does
>not appear?
>
>Thanks in advance.
>
>Uttam[/color]

  #3  
Old November 12th, 2005, 03:01 PM
rkc
Guest
 
Posts: n/a
Default Re: ADO Question


"Uttam" <u0107@hotmail.com> wrote in message
news:7735a614.0311021712.56775ec7@posting.google.c om...[color=blue]
> Hello,
>
> I have an array from which I load values into a table.
>
> My table creation is done using ADO.
>
> Some of the fields in the Array can have null values and I want to
> load the corresponding table field with the same values as in the
> array - that is null or non-null values.
>
> I have defined text fields in ADO in table creation as follows:
>
> With tbl
> .Name = "tbl_Name"
> Set .ParentCatalog = cat
> .Columns.Append "Case_Field", adWChar
> End With
>
> When the array contains null values I get a message saying "You tried
> to assign a Null Value for a variable that is not Variant Data Type"[/color]

If the error is in fact occuring when you try to add the values from the
array to the columns in the new table, it may be because you have not
defined the column(s) to allow null values.

This I know works with Jet:

Set col = New ADOX.column

With col
.Name = "Case_Field"
.Type = adWChar
.Attributes = adColNullable
End With

tbl.Columns.Append col






 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,662 network members.