Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Don't understand the error.

Author  Topic 

RichardBone
Starting Member

29 Posts

Posted - 2006-10-18 : 20:46:34
I'm doing code with VB.Net.

The error was:
System.FormatException: Input string was not in a correct format.


The line this is happening on is:
Response.Write("<TD><p>" + rdData("ClientRepID") + "</p></td>")


I don't understand, it is giving that error particularly when I want to get ClientRepID

Some more lines from the code:
Response.Write("<TD><p>" + rdData("Username") + "</p></TD>")
Response.Write("<TD><p>" + rdData("ClientRepID") + "</p></td>")

The first line the compiler had no problem but when it gets to the second line with ClientRepID it gives me this error. (ClientRepID exists in the database)

Can someone please help me? Thanks

snSQL
Master Smack Fu Yak Hacker

1837 Posts

Posted - 2006-10-18 : 21:03:21
Is the rep ID null perhaps? If so you'll either need to test it with the DataReader or replace it with ISNULL in your SQL query.
Go to Top of Page

RichardBone
Starting Member

29 Posts

Posted - 2006-10-18 : 21:07:57
It's not null. Every entry has information in it.
Go to Top of Page

snSQL
Master Smack Fu Yak Hacker

1837 Posts

Posted - 2006-10-18 : 21:46:32
How about if you do this?

Response.Write("<TD><p>" + rdData("ClientRepID").ToString() + "</p></td>")
Go to Top of Page

RichardBone
Starting Member

29 Posts

Posted - 2006-10-18 : 22:14:51
Wow that worked, thanks.
Go to Top of Page
   

- Advertisement -