parameter for column name
Posted: Fri 10 Mar 2006 05:58
mysqldataadapter query as follows:
SELECT
client_master.CCM_ID AS ID,
client_master.CCM_Name AS `Company Name`,
client_master.CCM_Address AS Address,
client_master.CCM_Suburb AS Suburb,
client_master.CCM_State AS State,
client_master.PCode AS PCode,
client_master.CCM_Country AS Country,
client_master.CCM_Phone AS Phone,
client_master.CCM_Fax AS Fax,
client_master.CCM_Email AS Email,
client_master.CCM_www AS Web,
client_master.CCM_Notes AS Notes,
client_master.CCM_Address1_PO AS `Postal Address`,
client_master.CCM_Suburb_PO AS `Postal Suburb`,
client_master.CCM_State_PO AS `Postal State`,
client_master.PCode_PO AS `Postal Pcode`,
client_master.CCM_Country_PO AS `Postal Country`,
client_master.CCM_Phone2 AS `Phone 2`,
client_master.CCM_Phone3 AS `Phone 3`,
client_master.CCM_Type AS `company Type`,
client_master.CCM_cust_cat AS Category,
client_master.CCM_area AS `NAV Area`,
client_master.CCM_visited AS `Visited Status`,
client_master.CCM_active AS `Active Staus`,
client_master.CCM_dt_create AS `Date Created`,
client_master.CCM_dt_modify AS `Date Modified`
FROM
newagev1.client_master
WHERE
newagev1.client_master.CCM_area = ? AND
newagev1.client_master.CCM_active = ? AND
newagev1.client_master.CCM_visited = ? AND
? LIKE ?
ORDER BY
`Company Name`,
PCode
All good till I put in the ? to replace the column name before the like. Can't invoke the last parameter properly which is a text string. Can i do this?
SELECT
client_master.CCM_ID AS ID,
client_master.CCM_Name AS `Company Name`,
client_master.CCM_Address AS Address,
client_master.CCM_Suburb AS Suburb,
client_master.CCM_State AS State,
client_master.PCode AS PCode,
client_master.CCM_Country AS Country,
client_master.CCM_Phone AS Phone,
client_master.CCM_Fax AS Fax,
client_master.CCM_Email AS Email,
client_master.CCM_www AS Web,
client_master.CCM_Notes AS Notes,
client_master.CCM_Address1_PO AS `Postal Address`,
client_master.CCM_Suburb_PO AS `Postal Suburb`,
client_master.CCM_State_PO AS `Postal State`,
client_master.PCode_PO AS `Postal Pcode`,
client_master.CCM_Country_PO AS `Postal Country`,
client_master.CCM_Phone2 AS `Phone 2`,
client_master.CCM_Phone3 AS `Phone 3`,
client_master.CCM_Type AS `company Type`,
client_master.CCM_cust_cat AS Category,
client_master.CCM_area AS `NAV Area`,
client_master.CCM_visited AS `Visited Status`,
client_master.CCM_active AS `Active Staus`,
client_master.CCM_dt_create AS `Date Created`,
client_master.CCM_dt_modify AS `Date Modified`
FROM
newagev1.client_master
WHERE
newagev1.client_master.CCM_area = ? AND
newagev1.client_master.CCM_active = ? AND
newagev1.client_master.CCM_visited = ? AND
? LIKE ?
ORDER BY
`Company Name`,
PCode
All good till I put in the ? to replace the column name before the like. Can't invoke the last parameter properly which is a text string. Can i do this?