Error with a code line. Urgent. Thank You.

M

Miguel Dias Moura

Hello,

i am inserting form values into a database and i am getting problems in this
line:

<Parameter Name="@Local02Metro" Value='<%# IIf(local02Metro.Checked <>
"", local02Metro.Checked, "") %>' Type="WChar" />

The error i get is this:

System.InvalidCastException: Cast from string "" to type 'Boolean' is not
valid. ---> System.FormatException: Input string was not in a correct
format.
at Microsoft.VisualBasic.CompilerServices.DoubleType.Parse(String Value,
NumberFormatInfo NumberFormat)
at Microsoft.VisualBasic.CompilerServices.BooleanType.FromString(String
Value)

Can you tell me what i need to change in my line?
Basicly i am getting the value of a check box.

I am working in ASP.net / VB.

Thank You,
Miguel
 
T

TJS

local02Metro.Checked will return a 1 or a 0

it won't compare to ""

try changing code to local02Metro.Checked =0
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top