fpweb and sqlquery lazarus / 63-Database ---------------------------------------------------------------------- dasa2 · 2021-06-14 20:19 I am building an HTTP server application with fpweb and want to run a sqlquery to verify that the username exist in db but getting an access violation when i try to run my sqlquery. What am i doing wrong here?  with SQLQuery1 do -> SQLQuery1 = = Cannot access memory at address 0x170 Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i unit umain; {$mode objfpc}{$H+} interface uses  SysUtils, Classes, httpdefs, fpHTTP, fpWeb, SQLDB, DB, SQLite3Conn, httproute; type   { TFPWebModule1 }   TFPWebModule1 = class(TFPWebModule)    SQLConnector1: TSQLConnector;    SQLTransaction1: TSQLTransaction;    SQLQuery1: TSQLQuery;    procedure DoStart(ARequest:TRequest; AResponse : TResponse);  private   public   end; var  FPWebModule1: TFPWebModule1; implementation {$R *.lfm} { TFPWebModule1 }  procedure TFPWebModule1.DoStart(ARequest:TRequest; AResponse : TResponse);var user : String;begin  user := ARequest.ContentFields.Values['user'];  if user = EmptyStr then    with AResponse.Contents do    begin      Add('
User:');      Add('');      Add('');      Add('
');    end  else    begin    with SQLQuery1 do        begin          Close();          Clear();        SQL.Text:='SELECT username, password FROM user WHERE username='+QuotedStr(user);          SQLConnection.Connected:=True;        SQLTransaction.Active:=True;          SQLQuery1.Active:=True;        Open();        end;      if SQLQuery1.RecordCount = 1 then      AResponse.Content := 'user: ' + user +'!'      else        AResponse.Content := 'Bad login';    end;end;  initialization  RegisterHTTPModule('TFPWebModule1', TFPWebModule1);  HTTPRouter.RegisterRoute('*', @FPWebModule1.DoStart); end. ---------------------------------------------------------------------- iLya2IK · 2021-06-15 14:25 I think, that you have not created an instance of the class and are trying to access it. Look carefully - SQLQuery1 is not even exist ---------------------------------------------------------------------- egsuh · 2021-06-16 02:04 What does TSQLQuery.Clear do?  Aren't you trying to SQLQuery1.SQL.Clear; ?