Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General » View Thread |
Messages 1 to 4 of 4 total |
Access Violation on XE2, advice needed. |
Mon, Jan 21 2013 11:35 PM | Permanent Link |
Mario Enríquez Open Consult | Could somebody please share some advice on this snippet?
I'm getting an Access Violation when I run the following code... function TsegDbUsuarios.GetUsuario(pId: string): TmkUsuario; var usr: TmkUsuario; begin qryGetUserInfo.SessionName := APP_SESSION; // <------------- AV Raised here.... qryGetUserInfo.DatabaseName := APP_DB; qryGetUserInfo.Close; qryGetUserInfo.ParamByName('Username').Value := pId; qryGetUserInfo.Open; usr := TmkUsuario.Create; if not qryGetUserInfo.IsEmpty then begin usr.Usuario := Trim(qryGetUserInfo.FieldByName('Name').AsString); usr.Contrasena := qryGetUserInfo.FieldByName('Password').AsString; usr.Comentarios := qryGetUserInfo.FieldByName('Description').AsString; usr.EmpleadoAsignado := ''; usr.EsAdministrador := EsAdministrador(pId); end; qryGetUserInfo.Close; Result := usr; end; qryGetUserInfo is defined this way... object qryGetUserInfo: TEDBQuery DatabaseName = 'DB' SessionName = 'AppSession' SQL.Strings = ( 'select Name, Password, Description' ' from Configuration.Users' ' where Name = :Username') Params = < item DataType = ftString Name = 'Username' ParamType = ptInput end> ReadOnly = True Left = 304 Top = 16 end However, I have another TEDBQuery in the same TDataModule as is working as expected. Does anybody had an idea of what is missing? Development is done with Delphi XE2 (32bit App) on Win7 64Bits. Regards, Mario |
Tue, Jan 22 2013 5:38 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Mario
Assuming APP_SESSION is a simple string the only thing that can be wrong is that qryGetUserInfo is not instantiated or has been freed. Looking at the code in edbcomps all the query will do when SessionName is set is unprepare itself so it doesn't matter if the session is there or not. Have you put a breakpoint on that line of code and checked to see if the query is nil? Roy Lambert [Team Elevate] |
Tue, Jan 22 2013 5:43 AM | Permanent Link |
Fernando Dias Team Elevate | Mario,
Where are you calling GetUsuario from? You are perhaps calling it before the qryGetUserInfo component has been created ... -- Fernando Dias [Team Elevate] |
Tue, Jan 22 2013 4:09 PM | Permanent Link |
Mario Enríquez Open Consult | Yep, you're right, calling before it was created.... duh!
(Note to myself, Stop playing with fancy instanciation methods and focus more on actual work!) Regards, Mario "Fernando Dias" wrote: Mario, Where are you calling GetUsuario from? You are perhaps calling it before the qryGetUserInfo component has been created ... -- Fernando Dias [Team Elevate] |
This web page was last updated on Saturday, April 27, 2024 at 08:52 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |