Board index » delphi » Access Violation at address 1B7FA647 in module msjets40.dll

Access Violation at address 1B7FA647 in module msjets40.dll

Hello,

I have a this code that i cant seem to get working...

  randomize;
  SessionID := Random(2000000000);
  // Add new session to the database
    with MainADOQuery do begin
      Close;
      SQL.BeginUpdate;
      SQL.Clear;
      SQL.Add('INSERT INTO sessions (SESSIONID,SESSTIMESTAMP,SESSDATA)');
      SQL.Add('VALUES (:theID, :thetime, :thedata);');
      SQL.EndUpdate;

      Parameters.ParamByName('theID').Value:= sessionID; //asinteger:=
sessionID;
      Parameters.ParamByName('thetime').Value:= now;     //.asdatetime:=
now;
      Parameters.ParamByName('thedata').Value:= '';     //.asstring:= '';

      ExecSQL;
    end; {with}

I always get a Access Violation at address 1B7FA647 in module msjets40.dll.
Read of address 00000000...

Would any one have any clue of what could be whrong???

Thanks
Christian

 

Re:Access Violation at address 1B7FA647 in module msjets40.dll


Still looking for the problem funy thig is that i can do a select no
problem...

  with MainADOQuery do begin
    Close;
    SQL.BeginUpdate;
    SQL.Clear;
    SQL.Add('SELECT SESSIONID,SESSTIMESTAMP,SESSDATA');
    SQL.Add('FROM SESSIONS');
    SQL.Add('WHERE SESSIONID = :sessid');
    SQL.EndUpdate;

    Parameters.ParamByName('sessid').Value:= SessionID;   //.asinteger:=
SessionID;
    Open;
  end; {with}

  if MainADOQuery.RecordCount = 1 then //we found a session
  begin
    SessionID:=MainADOQuery.FieldByName('SESSIONID').asinteger;
    SessionTimeStamp:= MainADOQuery.FieldByName('SESSTIMESTAMP').asdatetime;
    SessionData:= tstringlist.create;
    SessionData.text:=MainADOQuery.FieldByName('SESSDATA').asstring;
    result:=True;
  end
  else
    result:=False;

Thanks
Christian

Re:Access Violation at address 1B7FA647 in module msjets40.dll


Found the problem......

I was missing the
MainADOConnection.LoginPrompt:= False;
in my MainADOConnection creation....

Christian

Other Threads