Last post Sep 22, 2009 07:21 AM by cbenaveen_1982
Jul 25, 2006 01:21 PM|ARainbowSunshine|LINK
I keep getting this error, but i think everything looks fine... Any suggestions??
"Conversion from string "" to type 'Double' is not valid."
empID = Session(
equid = Session(
empequipid.CommandType = CommandType.Text
nbrID = empequipid.ExecuteScalar
empID = (DropDownList1.SelectedValue)
Jul 25, 2006 02:57 PMemail@example.com|LINK
You can easily get this error if the string data doesn't match to a double. For example, the string "Hello World!" is valid as a string but not as a double. Check the actual data.
Jul 25, 2006 03:16 PM|ARainbowSunshine|LINK
I don't fully understand...??
Column Name Data Type Null
EmployeeID int *
EquipID int *
I don't really know what a double is??
Jul 25, 2006 03:35 PM|Caddre|LINK
What RDBMS(relational database management syustems) are you using?
Jul 25, 2006 03:38 PM|MorningZ|LINK
Double is a DataType (numeric) and somewhere in your code (you fail to note what line throws that error) you are trying to use an empty string (the "" of the error msg) as a number and the code doesn't like it
Also... might want to look into
Tracing, much much better alternative to the comment/uncommet Response.Write stuff
Jul 25, 2006 10:35 PMfirstname.lastname@example.org|LINK
If you don't know what a type of "Double" is then why are you converting to it? For that matter, all your data types are integers, but it doesn't appear you'll be doing any math with them so they could all be text and you'd have less trouble. There's a
database issue here as well where EmployeeID and EquipID are nullable, but you can't use a null value in your conversion (or more correctly, you have to code for what to do with a null). I don't know your relationships or business rules, but I'd doubt that
any employee or piece of equipment you inventory can exist without an ID, though that's what your database allows.
For what it's worth, a Double data type is a double floating precision number that goes from really big to really small. If you had several billion employees you might need to use it, otherwise an integer would work, holding a bit over 2 billion employee
id numbers. :)
Might want to take a look at:
Jul 26, 2006 01:40 PM|ARainbowSunshine|LINK
I had to change the + to & and now it works
empequipid = New SqlCommand("Select EmpEquipID From EMPLOYEES_EQUIP Where EmployeeID = " & empID &
" AND EquipID = " & equid &
" ", myConnection)
Jul 27, 2006 03:02 AMemail@example.com|LINK
Difference in concatenation between VB and C#. Makes sense you were getting an error there, glad you got it sorted out.
Aug 16, 2008 11:37 AM|Binmese|LINK
thank ArainbowSunshine :) that's true. I looked for this. tried a lot of ideas but yours is true
Sep 22, 2009 07:05 AM|cbenaveen_1982|LINK
In vb 6 it is ----> &
in vb.net it is -----> +
in vb.net and Mysql once again it is -----> &
Sep 22, 2009 07:21 AM|cbenaveen_1982|LINK
use & when using vb6 and SQL 2000.
use + when working with vb.net and sql 2000
use & when working with vb.net and MySql