Thanks Memnoch,

I have got round with that error and now something else has cropped up. My
guess is that its something to do with data conversion.

I am getting this error, In my database, the field LoginName is set as
Vachar type. It looks as though there is a problem reading this field. could
you please enlighting me on what I have done wrong and what i could do to
correct this error.

Thanks for you Help.


''----------------------Error-------------------------
The data value could not be converted for reasons other than sign mismatch
or data overflow. For example, the data was corrupted in the data store but
the row was still retrievable.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details: System.InvalidCastException: The data value could not be
converted for reasons other than sign mismatch or data overflow. For example,
the data was corrupted in the data store but the row was still retrievable.

Source Error:

Line 56: authorisedusernameList.Items.Add( dataReader.GetString( 0 ) );

Source File: c:\inetpub\wwwroot\websupportproject\login.aspx.cs Line: 56

Stack Trace:
[InvalidCastException: The data value could not be converted for reasons
other than sign mismatch or data overflow. For example, the data was
corrupted in the data store but the row was still retrievable.]
System.Data.OleDb.DBBindings.get_ValueString()
System.Data.OleDb.OleDbDataReader.GetString(Int32 ordinal)
WebsupportProject.Login.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\websupportproject\login.aspx.cs:56
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()
'---------------end of error------------------------------



Thank you for your help so far.

Re: Data Type Error Reading from database by Sahil

Sahil
Mon Dec 06 09:33:19 CST 2004

Kojo,

Hard to say without setting a breakpoint at the offending line and checking
the values - but one of the possible fixes could be to change this line -

authorisedusernameList.Items.Add( dataReader.GetString( 0 ) );

to

authorisedusernameList.Items.Add( dataReader.GetString( 0 ).ToString() );

or

authorisedusernameList.Items.Add( (string) dataReader.GetString( 0 ) );

BTW, what is the datatype at column #0?

Again - the above might not be why you are getting this error, but it is
hard to debug without your setting a breakpoint and examining the value of
dataReader.GetString(0).

Another reason could be - you might not be getting any rows back out of your
query.

- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik
http://blogs.apress.com/authors.php?author=Sahil Malik

"kojosmooth" <kojosmooth@discussions.microsoft.com> wrote in message
news:772C2476-F55C-43BB-A99A-786954EC893A@microsoft.com...
> Thanks Memnoch,
>
> I have got round with that error and now something else has cropped up. My
> guess is that its something to do with data conversion.
>
> I am getting this error, In my database, the field LoginName is set as
> Vachar type. It looks as though there is a problem reading this field.
could
> you please enlighting me on what I have done wrong and what i could do to
> correct this error.
>
> Thanks for you Help.
>
>
> ''----------------------Error-------------------------
> The data value could not be converted for reasons other than sign mismatch
> or data overflow. For example, the data was corrupted in the data store
but
> the row was still retrievable.
> Description: An unhandled exception occurred during the execution of the
> current web request. Please review the stack trace for more information
about
> the error and where it originated in the code.
>
> Exception Details: System.InvalidCastException: The data value could not
be
> converted for reasons other than sign mismatch or data overflow. For
example,
> the data was corrupted in the data store but the row was still
retrievable.
>
> Source Error:
>
> Line 56: authorisedusernameList.Items.Add( dataReader.GetString(
0 ) );
>
> Source File: c:\inetpub\wwwroot\websupportproject\login.aspx.cs Line:
56
>
> Stack Trace:
> [InvalidCastException: The data value could not be converted for reasons
> other than sign mismatch or data overflow. For example, the data was
> corrupted in the data store but the row was still retrievable.]
> System.Data.OleDb.DBBindings.get_ValueString()
> System.Data.OleDb.OleDbDataReader.GetString(Int32 ordinal)
> WebsupportProject.Login.Page_Load(Object sender, EventArgs e) in
> c:\inetpub\wwwroot\websupportproject\login.aspx.cs:56
> System.Web.UI.Control.OnLoad(EventArgs e)
> System.Web.UI.Control.LoadRecursive()
> System.Web.UI.Page.ProcessRequestMain()
> '---------------end of error------------------------------
>
>
>
> Thank you for your help so far.
>



Re: Data Type Error Reading from database by kojosmooth

kojosmooth
Mon Dec 06 20:49:02 CST 2004

Hi Sahil,
Thanks for tolerating my bugging you with my queries, I have got round the
problem by using authorisedusernameList.Items.Add(
dataReader["LoginName"].ToString( ) ); (i got this help from another good guy
from a forum)
The code woks but unfortunately it doesn't show anything in the dropdwon list.
Thanks for your help, i'll try and figure out what I have gone wrong.

Cheers

"Sahil Malik" wrote:

> Kojo,
>
> Hard to say without setting a breakpoint at the offending line and checking
> the values - but one of the possible fixes could be to change this line -
>
> authorisedusernameList.Items.Add( dataReader.GetString( 0 ) );
>
> to
>
> authorisedusernameList.Items.Add( dataReader.GetString( 0 ).ToString() );
>
> or
>
> authorisedusernameList.Items.Add( (string) dataReader.GetString( 0 ) );
>
> BTW, what is the datatype at column #0?
>
> Again - the above might not be why you are getting this error, but it is
> hard to debug without your setting a breakpoint and examining the value of
> dataReader.GetString(0).
>
> Another reason could be - you might not be getting any rows back out of your
> query.
>
> - Sahil Malik
> http://dotnetjunkies.com/weblog/sahilmalik
> http://blogs.apress.com/authors.php?author=Sahil Malik
>
> "kojosmooth" <kojosmooth@discussions.microsoft.com> wrote in message
> news:772C2476-F55C-43BB-A99A-786954EC893A@microsoft.com...
> > Thanks Memnoch,
> >
> > I have got round with that error and now something else has cropped up. My
> > guess is that its something to do with data conversion.
> >
> > I am getting this error, In my database, the field LoginName is set as
> > Vachar type. It looks as though there is a problem reading this field.
> could
> > you please enlighting me on what I have done wrong and what i could do to
> > correct this error.
> >
> > Thanks for you Help.
> >
> >
> > ''----------------------Error-------------------------
> > The data value could not be converted for reasons other than sign mismatch
> > or data overflow. For example, the data was corrupted in the data store
> but
> > the row was still retrievable.
> > Description: An unhandled exception occurred during the execution of the
> > current web request. Please review the stack trace for more information
> about
> > the error and where it originated in the code.
> >
> > Exception Details: System.InvalidCastException: The data value could not
> be
> > converted for reasons other than sign mismatch or data overflow. For
> example,
> > the data was corrupted in the data store but the row was still
> retrievable.
> >
> > Source Error:
> >
> > Line 56: authorisedusernameList.Items.Add( dataReader.GetString(
> 0 ) );
> >
> > Source File: c:\inetpub\wwwroot\websupportproject\login.aspx.cs Line:
> 56
> >
> > Stack Trace:
> > [InvalidCastException: The data value could not be converted for reasons
> > other than sign mismatch or data overflow. For example, the data was
> > corrupted in the data store but the row was still retrievable.]
> > System.Data.OleDb.DBBindings.get_ValueString()
> > System.Data.OleDb.OleDbDataReader.GetString(Int32 ordinal)
> > WebsupportProject.Login.Page_Load(Object sender, EventArgs e) in
> > c:\inetpub\wwwroot\websupportproject\login.aspx.cs:56
> > System.Web.UI.Control.OnLoad(EventArgs e)
> > System.Web.UI.Control.LoadRecursive()
> > System.Web.UI.Page.ProcessRequestMain()
> > '---------------end of error------------------------------
> >
> >
> >
> > Thank you for your help so far.
> >
>
>
>

Re: Data Type Error Reading from database by Sahil

Sahil
Mon Dec 06 22:38:39 CST 2004

Kojo,

I don't mind your queries at all.

Try this - set a breakpoint there, see what that ToString evaluates to.
There is a neat little immediate window, or you can simply select the
expression at hit SHIFT_F9 to bring up a quickwatch window.

- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik



"kojosmooth" <kojosmooth@discussions.microsoft.com> wrote in message
news:08B4601D-6790-4A21-92EA-C2C59716DF60@microsoft.com...
> Hi Sahil,
> Thanks for tolerating my bugging you with my queries, I have got round the
> problem by using authorisedusernameList.Items.Add(
> dataReader["LoginName"].ToString( ) ); (i got this help from another good
> guy
> from a forum)
> The code woks but unfortunately it doesn't show anything in the dropdwon
> list.
> Thanks for your help, i'll try and figure out what I have gone wrong.
>
> Cheers
>
> "Sahil Malik" wrote:
>
>> Kojo,
>>
>> Hard to say without setting a breakpoint at the offending line and
>> checking
>> the values - but one of the possible fixes could be to change this line -
>>
>> authorisedusernameList.Items.Add( dataReader.GetString( 0 ) );
>>
>> to
>>
>> authorisedusernameList.Items.Add( dataReader.GetString( 0 ).ToString() );
>>
>> or
>>
>> authorisedusernameList.Items.Add( (string) dataReader.GetString( 0 ) );
>>
>> BTW, what is the datatype at column #0?
>>
>> Again - the above might not be why you are getting this error, but it is
>> hard to debug without your setting a breakpoint and examining the value
>> of
>> dataReader.GetString(0).
>>
>> Another reason could be - you might not be getting any rows back out of
>> your
>> query.
>>
>> - Sahil Malik
>> http://dotnetjunkies.com/weblog/sahilmalik
>> http://blogs.apress.com/authors.php?author=Sahil Malik
>>
>> "kojosmooth" <kojosmooth@discussions.microsoft.com> wrote in message
>> news:772C2476-F55C-43BB-A99A-786954EC893A@microsoft.com...
>> > Thanks Memnoch,
>> >
>> > I have got round with that error and now something else has cropped up.
>> > My
>> > guess is that its something to do with data conversion.
>> >
>> > I am getting this error, In my database, the field LoginName is set as
>> > Vachar type. It looks as though there is a problem reading this field.
>> could
>> > you please enlighting me on what I have done wrong and what i could do
>> > to
>> > correct this error.
>> >
>> > Thanks for you Help.
>> >
>> >
>> > ''----------------------Error-------------------------
>> > The data value could not be converted for reasons other than sign
>> > mismatch
>> > or data overflow. For example, the data was corrupted in the data store
>> but
>> > the row was still retrievable.
>> > Description: An unhandled exception occurred during the execution of
>> > the
>> > current web request. Please review the stack trace for more information
>> about
>> > the error and where it originated in the code.
>> >
>> > Exception Details: System.InvalidCastException: The data value could
>> > not
>> be
>> > converted for reasons other than sign mismatch or data overflow. For
>> example,
>> > the data was corrupted in the data store but the row was still
>> retrievable.
>> >
>> > Source Error:
>> >
>> > Line 56: authorisedusernameList.Items.Add( dataReader.GetString(
>> 0 ) );
>> >
>> > Source File: c:\inetpub\wwwroot\websupportproject\login.aspx.cs
>> > Line:
>> 56
>> >
>> > Stack Trace:
>> > [InvalidCastException: The data value could not be converted for
>> > reasons
>> > other than sign mismatch or data overflow. For example, the data was
>> > corrupted in the data store but the row was still retrievable.]
>> > System.Data.OleDb.DBBindings.get_ValueString()
>> > System.Data.OleDb.OleDbDataReader.GetString(Int32 ordinal)
>> > WebsupportProject.Login.Page_Load(Object sender, EventArgs e) in
>> > c:\inetpub\wwwroot\websupportproject\login.aspx.cs:56
>> > System.Web.UI.Control.OnLoad(EventArgs e)
>> > System.Web.UI.Control.LoadRecursive()
>> > System.Web.UI.Page.ProcessRequestMain()
>> > '---------------end of error------------------------------
>> >
>> >
>> >
>> > Thank you for your help so far.
>> >
>>
>>
>>