C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




i need to get numerical value from database to my variable...


Posted Date: 22 Jan 2008      Total Responses: 8

Posted By: Guruswamy T L       Member Level: Silver     Points: 2


how shall i intialize that variable in my code .. if i intialize as string or integer .. it giving error

Error converting data type varchar to numeric.




Responses

Author: srilu    22 Jan 2008Member Level: DiamondRating:     Points: 2

Check the data type of that variable in your database and the data type you need to show in the front end?

If it is numeric in the database,use convert.toint32 in the front end.
If it is varchar in the database,use convert.tostring




Author: santhosh    22 Jan 2008Member Level: GoldRating:     Points: 2
hi

your question is a bit harder to understand. Plz make it clear..

instead of using int or string, U better use object type.

Its better to use Objects if we don't know what type of data is to be loaded in that variable.




Author: Shanmugam    22 Jan 2008Member Level: GoldRating:     Points: 2
Can you post your conversion code?


Author: santhosh    22 Jan 2008Member Level: GoldRating:     Points: 2
hi

your question is a bit harder to understand. Plz make it clear..

instead of using int or string, U better use object type.

Its better to use Objects if we don't know what type of data is to be loaded in that variable.




Author: Krishna Prasad RVS    22 Jan 2008Member Level: GoldRating:     Points: 2
Hi,

Please provide the database column datatype, if you are declaring the varible of same type, it should work

Please provide details.

Krishna


Author: Lakshmanan M    22 Jan 2008Member Level: BronzeRating:     Points: 2
Can u Explain in detail?

For Getting data from DB which one u r using Data Adapter or DataReader?

if ur initializing a variable as string , while assigning the result to the variable u hav to use .ToSting() to convert the object to string value.


Author: Krishna Prasad RVS    22 Jan 2008Member Level: GoldRating:     Points: 2
You should declare a variable of the same data type of the specific database column for which you are declaring a variable to store the data


Author: Guruswamy T L    22 Jan 2008Member Level: SilverRating:     Points: 2
if i declare as object same error will come



Post Reply
You must Sign In to post a response.
Next : Website
Previous : Searching Values in a Dataset
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design

silicone halloween mask

Contact Us    Privacy Policy    Terms Of Use