Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do I execute stored procedure in SQL-server
Message
From
25/11/2004 09:22:47
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows 2000 SP3
Network:
Windows 2000 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
00963459
Message ID:
00964676
Views:
7
>Hi Surgey!
>
>Thanks for the link. Using the following code I can access records as follows:
>lcFile = "FILE NAME=" + "mydb.udl"
>oConn = NEWOBJECT("adodb.connection")
>oRecordSet = NEWOBJECT("adodb.recordset")
>
>oConn.open(lcFile)
>
>oRecordSet.open("select * from mytab",oConn)
>? oRecordRet.fields(1).value
>oRecordSet.MoveNext()
>? orecordset.fields(1).value
>
>This works fine. but how dow do I get this data into a grid or combo box.
>
>***
>
>Accessing the stored procedure I have used the following code:
>
>lcFile = "FILE NAME=" + "mydb.udl"
>oConn = NEWOBJECT("adodb.connection")
>oComm = NEWOBJECT("adodb.command")
>oRecordSet = NEWOBJECT("adodb.recordset")
>
>oConn.open(lcFile)
>WITH oComm
> .commandtext = "select_mytab_1"
> .activeconnection = oConn
> .commandtype = 4
> .execute
>ENDWITH
>
>How do I view the returned data? How can I attach this data to a grid or combo box.
>
>I am really lost here. Really appreciate some help.

Stuart,
You've VFP8, right? Then use CursorAdapter. CA can use ADO to fill in a cursor. If you don't want to and just to view the data in a grid:
Function ViewRS
Lparameters toRecordset
oForm = Createobject('myForm', toRecordset)
oForm.Show
Read Events
Endfunc

Define Class myform As Form
  Height = 450
  Width = 750
  Name = "Form1"

  Add Object hflex As OleControl With ;
    Top = 10, Left = 10, Height = 430, Width = 730, Name = "Hflex", ;
    OleClass = 'MSHierarchicalFlexGridLib.MSHFlexGrid'

  Procedure Init
  Lparameters toRecordset
  This.hflex.Datasource = toRecordset
Endproc
  Procedure QueryUnload
  Clear Events
Endproc
Enddefine
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform