DAAB binding variable

Topics: Data Access Application Block, Validation Application Block
Nov 13, 2009 at 9:58 PM


I want to construct a DbCommand using GetSqlStringCommand(). My sql statement is using binding variable, such as, select * from sometable where userid in(?user_ids). I use MySql data provider for my case.

I user database.AddInParameter(command, "?user_ids", DbType.String, userIds); to construct binding variable. My intention is select * from sometable where userid in (1,2,3), but it ended with select * from sometable where userid in ('1,2,3').

I guess DbType.String implicitly add single quota around my binding variable. I cannnot use DbType.Int32 neither for my case.

Any advice?

Thanks very much.

Nov 16, 2009 at 8:57 AM
Edited Nov 16, 2009 at 8:58 AM


Do you have any function that handles the comma delimited values and store them into a temp table? That is the common solution that I've saw while googling around.

Please see this: http://forge.mysql.com/tools/tool.php?id=4

Valiant Dudan
Global Technology and Solutions
Avanade, Inc.