Hi All,
 I have an application that connects to a MySQl database. I have found the only 
way to get Lazrus to work without giving me an error "Cannot access Active 
DataSet" is to do a Clear,Add, Open Close, like below

MainForm.SQLQuery1.SQL.Clear;

MainForm.SQLQuery1.SQL.Add('SELECT revID from rev WHERE 
revName='+#39+CBProcessRev.Text+#39);


MainForm.SQLQuery1.Open;

if MainForm.SQLQuery1.SQL.Text<>'' then
 if MainForm.SQLQuery1.RecordCount>0 then
    revID:=MainForm.SQLQuery1.FieldValues['revID'];
   // showmessage(IntToStr(revID));

MainForm.SQLQuery1.Close;

MainForm.SQLQuery1.SQL.Clear;

MainForm.SQLQuery1.SQL.Add('SELECT * from flow WHERE 
processID='+IntToStr(ProcessID)+
' AND '+IntToStr(revID)+'='+IntToStr(revID));

MainForm.SQLQuery1.Open;

if MainForm.SQLQuery1.SQL.Text<>'' then
 while Not MainForm.SQLQuery1.EOF do begin
 CBProcessFlow.Items.Add(MainForm.SQLQuery1.FieldValues['flowName']);
 MainForm.SQLQuery1.Next;
 end;

MainForm.SQLQuery1.Close;

My Question is why do I have to close and re open is there a better way of 
doing this. Thanks

Lefti
                           

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to