Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Don't see the error
Message
 
 
À
07/05/2013 18:59:47
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01572968
Message ID:
01572972
Vues:
30
>>Hi everybody,
>>
>>I am not sure why I am getting the error 'can not implicitly convert string booking type to Boolean') when I try to apply C# iif as in this command
>>
>>
>>sqlCommand.CommandText = "SELECT * FROM dbo.b_sched WHERE " + columnName + 
>>                  @" = @columnValue and start_time IS NOT NULL 
>>                       AND layer < 7 and is_pod" + ("POD"== bookingType)?">0":"=0";
>>
>>bookingType defined as String.
>>
>>Do you see what is wrong in this expression and why C# doesn't like it?
>
>
>Should it be something like bookingType.equals("POD")?

BTW, relevant question - in VFP in this particular method we're passing column name and column value and use our special VFP2SQL function to embed the value into the SQL String.

In C# I want to use parameter for the column value. However, I do not know what is the type of this value (I get it as a string).

So, I am wondering what syntax should I use to add this parameter.

I can use AddWithValue but I do not like using it in general. Would it be OK for this case or there is another way to add parameter without specifying its type?
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform