Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...Example Code?Example Code?
Previous
 
Next
New Post
10/1/2008 11:58 AM
 

Hi,

Would anyone be able to post some example code showing how to call a sproc with parameters and then set a variable to equal one of the records in the recordset please?

I am having terrible problems finding any example code on the internet.

Any help will be greatly appreciated

Thanks

Trev


www.taxiroute.co.uk - Get a Fare Price!
 
New Post
10/1/2008 1:34 PM
 


Michael Washington
http://ADefWebserver.com
www.ADefHelpDesk.com
A Free Open Source DotNetNuke Help Desk Module
 
New Post
10/1/2008 2:08 PM
 

Hi,

Thanks for the link. I have done my best to look through it but there is a lot of new things...

I want to try and get something finished tonight if possible...

I am trying to fire a store procedure with paramaters that will return a recordset with ONE row... I am using the following code:

Dim sqlDataProvider As SqlDataProvider = CType(DataProvider.Instance(), SqlDataProvider)
Dim connectStr As String = sqlDataProvider.ConnectionString
Dim dbo As String = sqlDataProvider.DatabaseOwner
Dim oq As String = sqlDataProvider.ObjectQualifier
   
Using dr As IDataReader = CType(SqlHelper.ExecuteReader(connectStr, dbo & oq & "TaxiRoute_GetFareCosts",1,1,2), IDataReader)
  
End Using

The SP when i run it returns a row with 4 columns....

I just want to pull each vlaue one by one when needed....

I used to do something like  FirstPartDistance = RSTaxiFares("FirstPartDisctance")

Trev


www.taxiroute.co.uk - Get a Fare Price!
 
New Post
10/2/2008 8:20 AM
 

Hi,

Sorry, it's me again.

I think I am getting closer but i am still getting errors...

Can anyone help me with what I am doing wrong please?

So far I have added the following section to my TaxiRouteInfo.vb file:

Public Class FareCostsInfo
  Private _TaxiType As Integer
  Public Property TaxiType() As Integer
  Get
  Return _TaxiType
  End Get
  Set(ByVal value As Integer)
  _TaxiType = value
  End Set
  End Property
  
  Private _TariffType As Integer
  Public Property TariffType() As Integer
  Get
  Return _TariffType
  End Get
  Set(ByVal value As Integer)
  _TariffType = value
  End Set
  End Property
  
  Private _AuthorityID As Integer
  Public Property AuthorityID() As Integer
  Get
  Return _AuthorityID
  End Get
  Set(ByVal value As Integer)
  _AuthorityID = value
  End Set
End Property

End Class

 

And I have added the following to my TaxiRouteController.vb

<DataObjectMethod(DataObjectMethodType.Select)> _
Public Shared Function TaxiRoute_GetFareCosts(ByVal TaxiType As Integer,ByVal TariffType As Integer,ByVal AuthorityID As Integer) As List(Of FareCostsInfo)
    Return CBO.FillCollection(Of FareCostsInfo)(CType(DataProvider.Instance().ExecuteReader("TaxiRoute_GetFareCosts", TaxiType,TariffType,AuthorityID), IDataReader))
End Function

 

But I get the following error

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC30456: 'ExecuteReader' is not a member of 'YourCompany.Modules.TaxiRoute.DataProvider'.

Source Error:

 
Line 49: <DataObjectMethod(DataObjectMethodType.Select)> _
Line 50: Public Shared Function TaxiRoute_GetFareCosts(ByVal TaxiType As Integer,ByVal TariffType As Integer,ByVal AuthorityID As Integer) As List(Of FareCostsInfo)
Line 51:     Return CBO.FillCollection(Of FareCostsInfo)(CType(DataProvider.Instance().ExecuteReader("TaxiRoute_GetFareCosts", TaxiType,TariffType,AuthorityID), IDataReader))
Line 52: End Function	
Line 53:

 

I also have a dataprovider.vb and a sqldataprovider.vb in my app_code/TaxiRoute directory which the tutorial seems to say I dont need.

Trev


www.taxiroute.co.uk - Get a Fare Price!
 
Previous
 
Next
HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...Example Code?Example Code?


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out