Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Monday, July 7, 2025 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Architect Forums - SalesLogix Scripting & Customization
Forum to discuss writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Scripting & Customization | New ThreadView:  Search:  
 Author  Thread: Populating Datagrids using Stored Procedures
Cory Haibloom
Posts: 39
 
Populating Datagrids using Stored ProceduresYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 Jul 10 4:45 PM
We are moving away from select statements to get data from outside DB's and converting everything over to stored procedures within the external db itself. I have a datagrid currently being populated using a select statement placed within datagrid.SQL.Text. How can I convert this over to populate it by directly calling a stored procedure (rather than by passing an "exec procedurename" in the .SQL.Text property)?
[Reply][Quote]
RJ Samp
Posts: 973
Top 10 forum poster: 973 posts
 
Re: Populating Datagrids using Stored ProceduresYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 20 Jul 10 12:30 PM
Stop using the .SQL.Text property for refreshing the datagrid.

Use

Set Grid.RecordSet = MyADORecordSet ' that's a LOAD and refresh display.....

instead.

Your stored procedure should be able to return an ADO Recordset to you.
[Reply][Quote]
Cory Haibloom
Posts: 39
 
Re: Populating Datagrids using Stored ProceduresYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 20 Jul 10 3:45 PM
I do that, and I get an error that says "Dataset does not support bookmarks, which are required for multi-record data controls". Any idea what this is and how to work around it?
[Reply][Quote]
RJ Samp
Posts: 973
Top 10 forum poster: 973 posts
 
Re: Populating Datagrids using Stored ProceduresYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 20 Jul 10 4:28 PM
1. get a copy of sussman's book ADO 2.6

2. set your recordset properties correctly

3. don't use bookmarks, use FILTER instead of FIND.

[Reply][Quote]
Cory Haibloom
Posts: 39
 
Re: Populating Datagrids using Stored ProceduresYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 21 Jul 10 11:18 AM
Thank you. I will look for Sussman's book. In the meantime, does anyone have a code snippet the provides an example of how to bind the results from a stored procedure to a datagrid?
[Reply][Quote]
RJ Samp
Posts: 973
Top 10 forum poster: 973 posts
 
Re: Populating Datagrids using Stored ProceduresYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 21 Jul 10 12:31 PM

'**************************************************************
' Name: RefreshGrid_grdLookup
' Purpose: Refreshes the data grid
' Assumptions: none.
' Effects: instantiate/create:
' SQL Server Native database connection object
' ADO Recordset object
' ADO Command object
' Parameter object
' Executes the ADO Command Object returning an ADO recordset.
' The ADO recordset is used to refresh the grid
' Inputs:
' The Grid Control
' TheUser's typed in search value.
' Returns: None
' Dev Notes: EB: The Seachstring should be passed in as a variable.
'**************************************************************
Sub RefreshGrid_grdLookup (ByRef theGrid, ByVal theUserInput)
Application.Debug.Writeline "59 20. RefreshGrid_grdLookup BEGIN "

Dim strSQL
Dim myNativeConn
Dim myRS

' ADO DB Command object
Dim objCommand

' Parameter(s) for the Command object
Dim objParam

' instantiate native connection object, opened.
' SLXDatabaseSupport_GetNativeConnection(ByRef TheConn)
Call SLXDatabaseSupport_GetNativeConnection( myNativeConn )

' Get a recordset
'SUB SLXDatabaseSupport_GetADORecordSet (ByRef TheRS)
Call SLXDatabaseSupport_GetADORecordSet (myRS)
' Add Fields to the recordset as needed
myRS.Fields.Append "OPPORTUNITYID", adChar, 12

' Declare the Select statement, identifying parameters with ?
strSQL = "SELECT A1.OPPORTUNITYID" & _
" , A1.DESCRIPTION" & _
" , A2.ACCOUNT A2_ACCOUNT" & _
" , A1.SALESPOTENTIAL" & _
" FROM sysdba.OPPORTUNITY A1 WITH(NOLOCK)" & _
" INNER JOIN ACCOUNT A2 WITH(NOLOCK) ON (A2.ACCOUNTID=A1.ACCOUNTID)" & _
" WHERE A1.OPPORTUNITYID LIKE ?" & _
" ORDER BY A1.OPPORTUNITYID "

' set up command object
Set objCommand = createObject("ADODB.Command")
objCommand.activeConnection = myNativeConn
objCommand.commandText = strSQL

' 1 line statement, not for general use
'objCommand.parameters.append(objCommand.createParameter("", adVarChar, adParamInput, 255, theUserInput))

Set objParam = createObject("ADODB.Parameter")
With objParam
.Type = adVarChar
.Size = 100
.Direction = adParamInput
.Value = theUserInput
End With

'Append the parameter(s) to command object
objCommand.Parameters.Append objParam

' Execute the command and store the results in a recordset
myRS.Open objCommand

' load / refresh the data grid.
set thegrid = myRS
'Call GridCommon_RefreshGridByRS (theGrid, myRS)

' housekeeping.
Set objCommand = Nothing
' Set objParam = Nothing
Set myNativeConn = Nothing
Set myRS = Nothing ' DO NOT CLOSE the recordset! Simply set this reference to nothing.
End Sub
<\pre>
[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 7/7/2025 12:40:02 PM