Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

invalid cast on datastore setitemstring

4 posts in DataWindow .NET Last posting was on 2004-10-12 01:36:29.0Z
Rajeev Gupta Posted on 2004-10-10 10:47:46.0Z
Sender: 303e.41691108.1804289383@sybase.com
From: Rajeev Gupta
Newsgroups: sybase.public.datawindow.net
Subject: invalid cast on datastore setitemstring
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <41691352.3041.1681692777@sybase.com>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 10 Oct 2004 03:47:46 -0700
X-Trace: forums-1-dub 1097405266 10.22.241.41 (10 Oct 2004 03:47:46 -0700)
X-Original-Trace: 10 Oct 2004 03:47:46 -0700, 10.22.241.41
Lines: 16
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.datawindow.net:514
Article PK: 124937

I am inserting data into a table using a datastore of dw.net
the last col of the table is a comment column of type char
and accepts null
when i update the datastore it gives invalid cast exception
error or
cast from string to type integer is not valid
when i comment out the that column line it works
this is the column line that gives the error

ds.setItemString(1,"comment","xxxxxx")


is there any thing wrong with this code i.e using
setitemstring for a char column that accepts null ??

thanks in advance


Jim O'Neil [Sybase] Posted on 2004-10-11 02:00:27.0Z
From: "Jim O'Neil [Sybase]" <joneil_at_sybase_dot_com>
Newsgroups: sybase.public.datawindow.net
Subject: Re: invalid cast on datastore setitemstring
Message-ID: <j7qjm0ht18gjteelmq5gpc6nq1akdab3n1@4ax.com>
References: <41691352.3041.1681692777@sybase.com>
X-Newsreader: Forte Agent 2.0/32.652
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: vpn-concord-081.sybase.com
X-Original-NNTP-Posting-Host: vpn-concord-081.sybase.com
Date: 10 Oct 2004 19:00:27 -0700
X-Trace: forums-1-dub 1097460027 158.159.8.81 (10 Oct 2004 19:00:27 -0700)
X-Original-Trace: 10 Oct 2004 19:00:27 -0700, vpn-concord-081.sybase.com
Lines: 25
X-Authenticated-User: teamsybase
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.datawindow.net:515
Article PK: 124945

That should work fine; however, I'm not clear on when the error
happens. You said when you update the datastore you get the
exception, but then you mentioned the SetItemString method. What
specific method throws the Invalid Cast Exception? UpdateData or
SetItmeString??

On 10 Oct 2004 03:47:46 -0700, Rajeev Gupta wrote:

>I am inserting data into a table using a datastore of dw.net
>the last col of the table is a comment column of type char
>and accepts null
>when i update the datastore it gives invalid cast exception
>error or
>cast from string to type integer is not valid
>when i comment out the that column line it works
>this is the column line that gives the error
>
>ds.setItemString(1,"comment","xxxxxx")
>
>
>is there any thing wrong with this code i.e using
>setitemstring for a char column that accepts null ??
>
>thanks in advance


dfish Posted on 2004-10-12 01:36:29.0Z
From: dfish@_no_spam_sybase.com (Dave Fish [Team Sybase])
Newsgroups: sybase.public.datawindow.net
Subject: Re: invalid cast on datastore setitemstring
Organization: Sybase Professional Services
Reply-To: nospam_dfish@sybase.com_nospam
Message-ID: <416b3460.791133179@forums.sybase.com>
References: <j7qjm0ht18gjteelmq5gpc6nq1akdab3n1@4ax.com> <416aaabc.7763.1681692777@sybase.com>
X-Newsreader: Forte Free Agent 1.21/32.243
X-Original-NNTP-Posting-Host: vpn-dub-083.sybase.com
X-Original-Trace: 11 Oct 2004 18:36:25 -0700, vpn-dub-083.sybase.com
Lines: 57
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 11 Oct 2004 18:36:26 -0700, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 11 Oct 2004 18:36:29 -0700
X-Trace: forums-1-dub 1097544989 10.22.108.75 (11 Oct 2004 18:36:29 -0700)
X-Original-Trace: 11 Oct 2004 18:36:29 -0700, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.datawindow.net:521
Article PK: 124949

In the DataWindow Designer go the Rows\Update Properties menu option.
Scroll down the list of Updateable columns and deselect the computed
column. Now the DataWindow will not try to generate SQL with that
column when doing an insert or update.

Regards,
Dave Fish
Sybase

TeamSybase blogs: http://www.teamsybase.net/blogs

DataWindow.NET code examples available on CodeXchange:
http://datawindownet.codexchange.sybase.com

On 11 Oct 2004 08:46:08 -0700, Rajeev Gupta wrote:

>The exception is in the updateData not setitem
>the column giving the trouble was not a true table col but a
>computed col in the datawindow source it is space(0) as
>comment
>
>so could this be the reason
>
>i have used this method to create dummy cols in the
>datasource of the dw as place holders for data in pb without
>any problem ?
>
>
>
>> That should work fine; however, I'm not clear on when the
>> error happens. You said when you update the datastore you
>> get the exception, but then you mentioned the
>> SetItemString method. What specific method throws the
>> Invalid Cast Exception? UpdateData or SetItmeString??
>>
>> On 10 Oct 2004 03:47:46 -0700, Rajeev Gupta wrote:
>>
>> >I am inserting data into a table using a datastore of
>> dw.net >the last col of the table is a comment column of
>> type char >and accepts null
>> >when i update the datastore it gives invalid cast
>> exception >error or
>> >cast from string to type integer is not valid
>> >when i comment out the that column line it works
>> >this is the column line that gives the error
>> >
>> >ds.setItemString(1,"comment","xxxxxx")
>> >
>> >
>> >is there any thing wrong with this code i.e using
>> >setitemstring for a char column that accepts null ??
>> >
>> >thanks in advance
>
>
>>