please use parameters

2009/5/7 Sree <[email protected]>

>
> HI I am using Nhibernate 2.0, my data contains sql string character
> ' , hence the HQL is failing(below is the HQL that failed)
>
> How can I handle this error?I don't want to change the data..
>
> Message : !Could not execute: select FROM PersonHistory AS PH  WHERE
> PH.Company.CompanyName = 'FRANK'S' and PH.FirstName = 'Brandon' and
> PH.LastName = 'Odom' and PH.ChargeCode = ''!
> could not execute query
> [ select personhist0_.PersonHistoryID as PersonHi1_17_,
> personhist0_.PersonGuid as PersonGuid17_,
> personhist0_.PersonHistoryGuid as PersonHi3_17_,
> personhist0_.SponsorName as SponsorN4_17_,
> personhist0_.MainLocationName as MainLoc26_17_,
> personhist0_.WorkingLocationID as Working27_17_,
> personhist0_.WorkingLocationName as Working28_17_,
> personhist0_.LastUpdatedBy as LastUpd29_17_,
> personhist0_.LastUpdatedDate as LastUpd30_17_ from POB_PERSON_HISTORY
> personhist0_, POB_COMPANIES company1_ where
> (company1_.CompanyName='FRANK' S ' and PH.FirstName = ' Brandon ' and
> PH.LastName = ' Odom ' and PH.ChargeCode = '  and
> personhist0_.CompanyID=company1_.CompanyID)]
>
> Inner Message : Incorrect syntax near 'S'.
>
> Exception Type : NHibernate.ADOException InnerException Type :
> NHibernate.ADOException
>
>
>
>
> >
>


-- 
Fabio Maulo

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to