How to bind a stored Procedure to a dropdownlist

Posts   
 
    
avarndel
User
Posts: 36
Joined: 14-Jun-2007
# Posted on: 28-Aug-2007 21:40:54   

I'm getting an error when trying to bind a dropdownlist to a storedProcedure . I'm using LLBLGen Pro 2.5 and vs 2005

Dim editor As GridDropDownListColumnEditor = CType(editMan.GetColumnEditor("Activities"), GridDropDownColumnEditor) Dim results As DataTable = PBDAL.StoredProcedureCallerClasses.RetrievalProcedures.GetProcXActivitiesLoadAllByCompanyIdisViewableCallAsQuery(CompanyID) 'Dim ddlTable As DataTable = GetBudgetRecords("SELECT Name FROM xRolesCategory") editor.DataSource = results editor.DataTextField = "Activities" editor.DataBind()

Error:

Unable to cast object of type 'SD.LLBLGen.Pro.ORMSupportClasses.RetrievalQuery' to type 'System.Data.DataTable'.

I got the code from the documentation on storeprocedures.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 29-Aug-2007 10:13:02   

For each retrieval SP, LLBLGen Pro generates to methods to call.

One of the returns a DataTable; eg. RetrievalProcedures.ProcXActivitiesLoadAllByCompanyIdisViewable(...)

And the other one returns an IRetievalQuery. eg. RetrievalProcedures.GetProcXActivitiesLoadAllByCompanyIdisViewableCallAsQuery(...)

Please refer to the LLBLGen Pro docs "Using the generated code -> Adapter/SelfServicing -> Calling a stored procedure"