When commandType is set to text, named parameter is not supported for the command.
in order to pass in parameter, use the question mark (?) as a placeholder. multiple parameters will have to put in the order of the place in the query.
for example:
SELECT * FROM Customer WHERE insert_time between ? and ?
cmd.Parameters.Add("@startDate", OdbcType.DateTime).Value = startDate;
cmd.Parameters.Add("@endDate", OdbcType.DateTime).Value = endDate;
http://msdn.microsoft.com/en-us/library/system.data.odbc.odbccommand.parameters(v=VS.100).aspx
No comments:
Post a Comment