Solved

MS SQL DB-Library and Delphi

Posted on 1998-08-31
1
294 Views
Last Modified: 2010-04-03
Does anybody out there has an example of the use of cursors with MSSQL 6.x DB-Library from Delphi?.

I'll apreciate some help.
0
Comment
Question by:Mak042298
1 Comment
 

Accepted Solution

by:
ltw earned 100 total points
ID: 1338255
I have used Delphi with Sybase which is or was virtually identical to MS-SQL at this level at least.  I don't remember ever needing to use SQL cursors directly in Delphi apps (since Delphi does it for you) but I frequently used them in SQL triggers and stored procedures.  If that is what you want to do, here is a brief (and somewhat silly) example from a stored procedure:

 declare @custid numeric(9,0)
 select @custid = 12345
 declare @oid    numeric(9,0)
 declare mycursor cursor for
     select order_id from orders where cust_id = @custid
 open mycursor
 fetch mycursor into @oid
 while (@@sqlstatus = 0)
   begin
     /* do something with the data such as insert  
        into another table */
     insert into custorders values (@custid,@oid)

     /* move the cursor to the next row of the result */
     fetch order_cursor into @oid
   end
 close mycursor
 deallocate cursor mycursor


0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi Dbf export problem to a Visual Foxpro application 6 163
Delphi - replicating a form 8 66
Help on project with Soap 10 48
SUM 2 INTEGER ARRAYS INTO 1 10 93
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now