I have a C# function accessing an MS Access db
When using the next statements inside my C# query string
"... where im.insp_mission_number like '%1%' ..."
it retrieves all insp_mission_number containing 1
But when i'm using parameters nothing is working
"... where im.insp_mission_number like '%@insp_mission_number%' ..."
where is the problem ?
Is it with @, ', %%, or what ... ?
Thanks in advance
Here is my code
public DataTable getInspectionMissions(InspectionMissionExt ime)
{
string query = string.Format("SELECT im.*, i.first_name + i.surname AS inspector_name, b.name AS branch_name, m.name AS ministry_name FROM (((insp_mission AS im left join inspector as i on im.inspector_id = i.id) left join branch as b on im.insp_branch_id = b.id) left join ministry m on im.ministry_id = m.id)where im.insp_mission_number like '%@insp_mission_number%' and im.insp_branch_id = @insp_branch_id and im.inspector_id = @inspector_id and im.ministry_id = @ministry_id");
OleDbParameter[] oledbParameters = new OleDbParameter[4];
oledbParameters[0] = new OleDbParameter("@insp_mission_number", OleDbType.VarChar);
oledbParameters[0].Value = Convert.ToString(ime.insp_mission_number);
oledbParameters[1] = new OleDbParameter("@insp_branch_id", OleDbType.Integer);
oledbParameters[1].Value = Convert.ToUInt64(ime.insp_branch_id);
oledbParameters[2] = new OleDbParameter("@inspector_id", OleDbType.Integer);
oledbParameters[2].Value = Convert.ToUInt64(ime.inspector_id);
oledbParameters[3] = new OleDbParameter("@ministry_id", OleDbType.Integer);
oledbParameters[3].Value = Convert.ToUInt64(ime.ministry_id);
return conn.executeSelectQuery(query, oledbParameters);
}