?
Solved

MS SQL DB-Library and Delphi

Posted on 1998-08-31
1
Medium Priority
?
301 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
ltw earned 200 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

770 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