PC Review


Reply
Thread Tools Rate Thread

cast string to long

 
 
mp
Guest
Posts: n/a
 
      9th Feb 2005
How do i cast a string from sql to a long? lDocumentVersion is long,
oSqlDR.GetValue(0) returns a string.



lDocumentVersion =oSqlDR.GetValue(0);



Thanks


 
Reply With Quote
 
 
 
 
Jon Sagara
Guest
Posts: n/a
 
      9th Feb 2005
Did you try one of the Convert.To* methods? Try Convert.ToInt64.

http://msdn.microsoft.com/library/de...Int64Topic.asp


"mp" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> How do i cast a string from sql to a long? lDocumentVersion is long,
> oSqlDR.GetValue(0) returns a string.
>
>
>
> lDocumentVersion =oSqlDR.GetValue(0);
>
>
>
> Thanks
>
>



 
Reply With Quote
 
Tom Porterfield
Guest
Posts: n/a
 
      9th Feb 2005
On Wed, 9 Feb 2005 14:33:00 -0600, mp wrote:

> How do i cast a string from sql to a long? lDocumentVersion is long,
> oSqlDR.GetValue(0) returns a string.
>
> lDocumentVersion =oSqlDR.GetValue(0);


You can't cast it but you can convert it. Use Convert.ToInt64(string)
overload. Check for null first if that is a possible value. Or if you
want more control, use one of the overloads of Int64.Parse.
--
Tom Porterfield
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cast to long RP Microsoft C# .NET 1 8th Nov 2007 11:02 AM
Cast HDC to long Emmanuel DURAND Microsoft VC .NET 2 6th Dec 2005 03:44 PM
Cast from string "2076719" to type 'Long' is not valid rsine Microsoft VB .NET 6 6th Dec 2004 12:09 PM
Re: Cast from string "2076719" to type 'Long' is not valid rsine Microsoft VB .NET 0 9th Jan 2004 05:28 PM
Re: Cast from string "2076719" to type 'Long' is not valid rsine Microsoft VB .NET 0 9th Jan 2004 01:27 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:35 AM.