Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2008-05

Inactive Dataset

24 messages · 8 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Dave Coventry

Hi,

I'm getting this: "operation cannot be performed on an inactive dataset".

Googling (I'm on a slow dialup on someone else's line) seems to indicate that the problem is with my Lazarus version.

The version I'm using is 0.9.23 beta SVN rev 12712.

I obviously can't download a new version of Lazarus...

Can anyone advise me?

Reply by email

Dave Coventry
to Dave Coventry

Sorry,

I should have been more specific....

SQLQuery1.SQL.Text:='SELECT fname,
sname,id,comboboxcourse,studentnumber,enquirydate,enquiryreferencenumber
from registration WHERE fname=''Dave''';
  StringGrid1.RowCount:=2;
  SQLQuery1.SQL.Text:=sqlq;
  SQLQuery1.Open;
  SQLQuery1.First;
  while not SQLQuery1.EOF do
  begin
    StringGrid1.Cells[0,i]:=SQLQuery1.FieldByName('fname').AsString;
    StringGrid1.Cells[1,i]:=SQLQuery1.FieldByName('sname').AsString;
    StringGrid1.Cells[2,i]:=SQLQuery1.FieldByName('id').AsString;
    StringGrid1.Cells[3,i]:=SQLQuery1.FieldByName('comboboxcourse').AsString;
    StringGrid1.Cells[4,i]:=SQLQuery1.FieldByName('studentnumber').AsString;
    StringGrid1.Cells[5,i]:=SQLQuery1.FieldByName('enquirydate').AsString;
    RecNumber:=RecNumber+','+SQLQuery1.FieldByName('enquiryreferencenumber').AsString;
    inc(i);
    StringGrid1.RowCount:=i+1;
  end;
  SQLQuery1.Close;
Dave Coventry wrote 13 lines
Hi, I'm getting this: "operation cannot be performed on an inactive dataset". Googling (I'm on a slow dialup on someone else's line) seems to indicate that the problem is with my Lazarus version. The version I'm using is 0.9.23 beta SVN rev 12712. I obviously can't download a new version of Lazarus... Can anyone advise me?

Reply by email

Michael Van Canneyt
to Dave Coventry
Dave Coventry wrote 7 lines
Sorry, I should have been more specific.... SQLQuery1.SQL.Text:='SELECT fname, sname,id,comboboxcourse,studentnumber,enquirydate,enquiryreferencenumber from registration WHERE fname=''Dave''';

Are you sure the query is closed at this point ?
If not, then you'll get this error.

Michael.

Reply by email

Graeme Geldenhuys
to Dave Coventry: I should have been more specific.... SQLQuery1.SQL.Text:='SELECT fname,…

2008/5/28 Dave Coventry :

Show quoted text 19 lines
SQLQuery1.SQL.Text:='SELECT fname, sname,id,comboboxcourse,studentnumber,enquirydate,enquiryreferencenumber from registration WHERE fname=''Dave'''; StringGrid1.RowCount:=2; SQLQuery1.SQL.Text:=sqlq; SQLQuery1.Open; SQLQuery1.First; while not SQLQuery1.EOF do begin StringGrid1.Cells[0,i]:=SQLQuery1.FieldByName('fname').AsString; StringGrid1.Cells[1,i]:=SQLQuery1.FieldByName('sname').AsString; StringGrid1.Cells[2,i]:=SQLQuery1.FieldByName('id').AsString; StringGrid1.Cells[3,i]:=SQLQuery1.FieldByName('comboboxcourse').AsString; StringGrid1.Cells[4,i]:=SQLQuery1.FieldByName('studentnumber').AsString; StringGrid1.Cells[5,i]:=SQLQuery1.FieldByName('enquirydate').AsString; RecNumber:=RecNumber+','+SQLQuery1.FieldByName('enquiryreferencenumber').AsString; inc(i); StringGrid1.RowCount:=i+1;
You forgot the line:
   SQLQuery1.Next;
end; SQLQuery1.Close;

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Michael Van Canneyt
to Dave Coventry
Dave Coventry wrote 10 lines
On Wed, May 28, 2008 at 10:45 AM, Graeme Geldenhuys wrote: > You forgot the line: > SQLQuery1.Next; So I did! However, putting it back in still gives me the same error. As does explicitly using "SQLQuery.Close" prior to opening the Query. :(

Do you know at which line of your code the error occurs ? (add writeln()) statements or so...)

Michael.

Reply by email

Dave Coventry
to Dave Coventry: On Wed, May 28, 2008 at 10:45 AM, Graeme Geldenhuys So I did! However, putting it back in…

A Clue!

Previously I had this code:

      SQLQuery1.SQL.Text:='SELECT enquiryreferencenumber FROM
registration WHERE fname='''+fname.Text+''' AND
sname='''+sname.Text+'''ORDER BY enquiryreferencenumber DESC LIMIT
1;';
      SQLQuery1.Open;
      enquiryreferencenumber.Text:=SQLQuery1.FieldByName('enquiryreferencenumber').AsString;
      SQLQuery1.Close;

Which raised an error saying that "enquiryreferencenumber" was not found. Then I added the line SQLQuery1.First; as listed below, which gave the Inactive Dataset error.

      SQLQuery1.SQL.Text:='SELECT enquiryreferencenumber FROM
registration WHERE fname='''+fname.Text+''' AND
sname='''+sname.Text+'''ORDER BY enquiryreferencenumber DESC LIMIT
1;';
      SQLQuery1.Open;
      SQLQuery1.First;
      enquiryreferencenumber.Text:=SQLQuery1.FieldByName('enquiryreferencenumber').AsString;
      SQLQuery1.Close;

Reply by email

Michael Van Canneyt
to Dave Coventry
Dave Coventry wrote 9 lines
On Wed, May 28, 2008 at 2:15 PM, Michael Van Canneyt wrote: > Do you know at which line of your code the error occurs ? > (add writeln()) statements or so...) Hi Michael, I put a breakpoint in and the error occurs when the code gets to "SQLQuery1.First;"

Seems like some internal error in sqldb code; At that point the dataset should already be open.

I think this is for Joost.

Michael.

Reply by email

Dave Coventry
to Michael Van Canneyt

Joost, Michael,

Will it take long to fix? (are we talking a quick patch, or three weeks work?)

I was supposed to demonstrate my app yesterday and had managed to get a bit of a dispensation because I was so close.

However, I think they will probably drop my project if I can't demonstrate it today....

Reply by email

Dave Coventry
to Dave Coventry

Alternatively, is there another way of extracting the information?

Dave Coventry wrote 10 lines
Joost, Michael, Will it take long to fix? (are we talking a quick patch, or three weeks work?) I was supposed to demonstrate my app yesterday and had managed to get a bit of a dispensation because I was so close. However, I think they will probably drop my project if I can't demonstrate it today....

Reply by email

Michael Van Canneyt
to Dave Coventry: Will it take long to fix? (are we talking a quick patch, or three weeks work?) I was…
Dave Coventry wrote 9 lines
Joost, Michael, Will it take long to fix? (are we talking a quick patch, or three weeks work?) I was supposed to demonstrate my app yesterday and had managed to get a bit of a dispensation because I was so close. However, I think they will probably drop my project if I can't demonstrate it today....

Normally, it should already be fixed, but as I understood it, you can't upgrade ?

Can you try to get the (sql)db units from SVN ?
Or I can zip the lot and mail them to you if you prefer.

Michael.

Reply by email

Graeme Geldenhuys
to Dave Coventry: Alternatively, is there another way of extracting the information?

If you go

   Query.Last;  // <<--- New line
   Query.First;

Does it give an error on the call to Last?

Graeme.

2008/5/28 Dave Coventry :

Show quoted text 18 lines
Alternatively, is there another way of extracting the information? On Wed, May 28, 2008 at 3:25 PM, Dave Coventry wrote: > Joost, Michael, > > Will it take long to fix? (are we talking a quick patch, or three weeks work?) > > I was supposed to demonstrate my app yesterday and had managed to get > a bit of a dispensation because I was so close. > > However, I think they will probably drop my project if I can't > demonstrate it today.... > _______________________________________________ Lazarus mailing list http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Regards, - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/

Reply by email

Dave Coventry
to Graeme Geldenhuys
Graeme Geldenhuys wrote 6 lines
If you go Query.Last; // <<--- New line Query.First; Does it give an error on the call to Last?

Yes.

The error is on last.

Michael, It would be very kind of you if you could email them to me as you offered.

I am, indeed on dialup, but the owner of the line has been very understanding and, if push came to shove, I could download fpc.

Many thanks!

Dave

Reply by email

Marc Santhoff
to Dave Coventry: I should have been more specific.... SQLQuery1.SQL.Text:='SELECT fname,…

Hi,

I'm not really sure if this is a c&p-error or the like, but ...

Dave Coventry wrote 9 lines
Sorry, I should have been more specific.... SQLQuery1.SQL.Text:='SELECT fname, sname,id,comboboxcourse,studentnumber,enquirydate,enquiryreferencenumber from registration WHERE fname=''Dave'''; StringGrid1.RowCount:=2; SQLQuery1.SQL.Text:=sqlq;

... here you assign another string named sqlq and overwrite the nice SQL from above.

Maybe that line is still in your code messing up the query?

HTH,
Marc

Show quoted text 35 lines
SQLQuery1.Open; SQLQuery1.First; while not SQLQuery1.EOF do begin StringGrid1.Cells[0,i]:=SQLQuery1.FieldByName('fname').AsString; StringGrid1.Cells[1,i]:=SQLQuery1.FieldByName('sname').AsString; StringGrid1.Cells[2,i]:=SQLQuery1.FieldByName('id').AsString; StringGrid1.Cells[3,i]:=SQLQuery1.FieldByName('comboboxcourse').AsString; StringGrid1.Cells[4,i]:=SQLQuery1.FieldByName('studentnumber').AsString; StringGrid1.Cells[5,i]:=SQLQuery1.FieldByName('enquirydate').AsString; RecNumber:=RecNumber+','+SQLQuery1.FieldByName('enquiryreferencenumber').AsString; inc(i); StringGrid1.RowCount:=i+1; end; SQLQuery1.Close; On Wed, May 28, 2008 at 9:01 AM, Dave Coventry wrote: > Hi, > > I'm getting this: "operation cannot be performed on an inactive dataset". > > Googling (I'm on a slow dialup on someone else's line) seems to > indicate that the problem is with my Lazarus version. > > The version I'm using is 0.9.23 beta SVN rev 12712. > > I obviously can't download a new version of Lazarus... > > Can anyone advise me? > _______________________________________________ Lazarus mailing list http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Juan Cortés Cuesta
to Dave Coventry: A Clue! Previously I had this code: SQLQuery1.SQL.Text:='SELECT enquiryreferencenumber…

Hi!
I Pasted your code in my Lazarus' Text Editor....
I think the error is in the Query.
Try with:

 SQLQuery1.SQL.Text:='SELECT enquiryreferencenumber FROM
 registration WHERE fname=' + #39 + fname.Text+ #39 + ' AND
 sname=' + #39 +sname.Text+ #39 + ' ORDER BY enquiryreferencenumber DESC LIMIT
 1;';

On 28 May 2008 at 14:31, Dave Coventry wrote:

Reply by email

Dave Coventry
to Marc Santhoff: I'm not really sure if this is a c&p-error or the like, but ... ... here you assign…

Marc,

Thanks very much for looking at the code. My fault, the above example is a cut and paste from the original code and my cutting knife must have slipped!

In any case, the SQLQuery1.SQL.Text is not overwirrten in my code. :)

Marc Santhoff wrote 64 lines
Hi, I'm not really sure if this is a c&p-error or the like, but ... Am Mittwoch, den 28.05.2008, 10:32 +0200 schrieb Dave Coventry: > Sorry, > > I should have been more specific.... > > SQLQuery1.SQL.Text:='SELECT fname, > sname,id,comboboxcourse,studentnumber,enquirydate,enquiryreferencenumber > from registration WHERE fname=''Dave'''; > StringGrid1.RowCount:=2; > SQLQuery1.SQL.Text:=sqlq; ... here you assign another string named sqlq and overwrite the nice SQL from above. Maybe that line is still in your code messing up the query? HTH, Marc > SQLQuery1.Open; > SQLQuery1.First; > while not SQLQuery1.EOF do > begin > StringGrid1.Cells[0,i]:=SQLQuery1.FieldByName('fname').AsString; > StringGrid1.Cells[1,i]:=SQLQuery1.FieldByName('sname').AsString; > StringGrid1.Cells[2,i]:=SQLQuery1.FieldByName('id').AsString; > StringGrid1.Cells[3,i]:=SQLQuery1.FieldByName('comboboxcourse').AsString; > StringGrid1.Cells[4,i]:=SQLQuery1.FieldByName('studentnumber').AsString; > StringGrid1.Cells[5,i]:=SQLQuery1.FieldByName('enquirydate').AsString; > RecNumber:=RecNumber+','+SQLQuery1.FieldByName('enquiryreferencenumber').AsString; > inc(i); > StringGrid1.RowCount:=i+1; > end; > SQLQuery1.Close; > > On Wed, May 28, 2008 at 9:01 AM, Dave Coventry wrote: > > Hi, > > > > I'm getting this: "operation cannot be performed on an inactive dataset". > > > > Googling (I'm on a slow dialup on someone else's line) seems to > > indicate that the problem is with my Lazarus version. > > > > The version I'm using is 0.9.23 beta SVN rev 12712. > > > > I obviously can't download a new version of Lazarus... > > > > Can anyone advise me? > > > _______________________________________________ > Lazarus mailing list > > http://www.lazarus.freepascal.org/mailman/listinfo/lazarus > _______________________________________________ Lazarus mailing list http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Graeme Geldenhuys
to Juan Cortés Cuesta: Hi! I Pasted your code in my Lazarus' Text Editor.... I think the error is in the Query.…

2008/5/28 Juan Cort?s Cuesta :

Show quoted text 9 lines
I Pasted your code in my Lazarus' Text Editor.... I think the error is in the Query. Try with: SQLQuery1.SQL.Text:='SELECT enquiryreferencenumber FROM registration WHERE fname=' + #39 + fname.Text+ #39 + ' AND sname=' + #39 +sname.Text+ #39 + ' ORDER BY enquiryreferencenumber DESC LIMIT 1;';

Alternatively, use parameters in you query....

Query1.SQL.Text :=
   'SELECT fname,sname,id,comboboxcourse,' +
   '  studentnumber,'enquirydate,enquiryreferencenumber ' +
   'FROM registration ' +
   'WHERE fname=:fname';
Query1.ParamAsString['fname'] := 'Dave';

This removes the ugly double quotes and hash values etc...

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Jalal

123555

Dave Coventry,

As does explicitly using "SQLQuery.Close" prior to opening the Query. :(
I suggest you use SQLQuery.Active := True (or False) instead of Open and Close.
Alternatively, is there another way of extracting the information?

If you don't need the db-aware visual controls you can use the libpq functions directly, they aren't hard to use. Some are:

PQconnectdb
PQstatus
PQexec
PQnfields
PQntuples
PQfname
PQgetvalue
PQclear
PQfinish
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20080528/3446138d/attachment.html

Reply by email

Dave Coventry
to Jalal

Aaaaah.

I was uable to compile the fpc db libs but I managed to get access to a broadband connection and downloaded the daily snapshot.

Now I can't load my app into Lazarus:

2008/5/28 Jalal :

Show quoted text 31 lines
123555 Dave Coventry, > As does explicitly using "SQLQuery.Close" prior to opening the Query. :( I suggest you use SQLQuery.Active := True (or False) instead of Open and Close. > Alternatively, is there another way of extracting the information? If you don't need the db-aware visual controls you can use the libpq functions directly, they aren't hard to use. Some are: PQconnectdb PQstatus PQexec PQnfields PQntuples PQfname PQgetvalue PQclear PQfinish _______________________________________________ Lazarus mailing list http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
A non-text attachment was scrubbed...
Name: error1.png
Type: image/png
Size: 10654 bytes
Desc: not available
Url : http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20080529/2e3114cc/attachment-0002.png -------------- next part --------------
A non-text attachment was scrubbed...
Name: error2.png
Type: image/png
Size: 8441 bytes
Desc: not available
Url : http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20080529/2e3114cc/attachment-0003.png

Reply by email

Vincent Snijders
to Dave Coventry
Dave Coventry wrote
Aaaaah. I was uable to compile the fpc db libs but I managed to get access to a broadband connection and downloaded the daily snapshot.

I cannot help you, but what daily snapshot, there are several flavors: using fpc 2.2.0, 2.2.1 or 2.3.1?

Vincent

Reply by email

Joost van der Sluis
to Dave Coventry

Op donderdag 29-05-2008 om 10:21 uur [tijdzone +0200], schreef Dave Coventry:

Next step, removed the Reference in the Datasource property of the SQLQuery. It Works!

Duh.

That sounds logical. And I do aggree that this is very confusing. I already wanted to change that, but it's Delphi compatibility....

But maybe we can do something about that error message. Maybe we can detect this problem somewhat better....

Joost

Reply by email

Michael Van Canneyt
to Joost van der Sluis
Joost van der Sluis wrote 13 lines
Op donderdag 29-05-2008 om 10:21 uur [tijdzone +0200], schreef Dave Coventry: > > Next step, removed the Reference in the Datasource property of the > SQLQuery. It Works! Duh. That sounds logical. And I do aggree that this is very confusing. I already wanted to change that, but it's Delphi compatibility.... But maybe we can do something about that error message. Maybe we can detect this problem somewhat better....

I think that changing the error message to something like 'failed to open master datasource: '+E.Message
would be better.

Michael.

Reply by email