N
Neven Klofutar
Hi,
I have a problem with creation of SQL query when I try to use parameter (I'm
not using stored procedure).
SELECT * FROM Contact WHERE prefix IN (@strPrefix)
@strPrefix is created:
SqlParameters[] arlSqlParams = new SqlParameters[1];
arlSqlParams[0] = new SqlParameter("@strPrefix", SqlDbType.NVarChar);
arlSqlParams[0].value = strPrefix
strPrefix is created dinamicaly, it's value looks like: '01','021','022' so
when inserted into query, query should look like:
SELECT * FROM Contact WHERE prefix IN ('01','021','022')
When I try to build query manualy, everything works perfectly.
" SELECT * FROM Contact WHERE prefix IN (" + strPrefix + ") "
When using parametriset version Exception is not thrown, I just get empty
DataSet.
Thanks, Neven
I have a problem with creation of SQL query when I try to use parameter (I'm
not using stored procedure).
SELECT * FROM Contact WHERE prefix IN (@strPrefix)
@strPrefix is created:
SqlParameters[] arlSqlParams = new SqlParameters[1];
arlSqlParams[0] = new SqlParameter("@strPrefix", SqlDbType.NVarChar);
arlSqlParams[0].value = strPrefix
strPrefix is created dinamicaly, it's value looks like: '01','021','022' so
when inserted into query, query should look like:
SELECT * FROM Contact WHERE prefix IN ('01','021','022')
When I try to build query manualy, everything works perfectly.
" SELECT * FROM Contact WHERE prefix IN (" + strPrefix + ") "
When using parametriset version Exception is not thrown, I just get empty
DataSet.
Thanks, Neven