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

HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...How best to call an sproc from a controlHow best to call an sproc from a control
Previous
 
Next
New Post
1/22/2010 9:13 AM
 

 Hello All,

[Using DNN 5.2.2]

As you can see from the code below, I want to do a simple execute of a stored procedure.  The code below is not working, but the connection string looks OK.  I have two questions here, 

1) Any idea why the code is not executing?

2) what is the better way to execute an sproc from within DNN programming environment.  Should I be using something like sqlhelper.  But I cannot find such a helper.

 

Thanks a lot in advance,

 

Mark Breen

Ireland


Mark Breen Ireland 1987 BMW R80 g/s
 
New Post
1/22/2010 5:18 PM
 

Hi Mark, you forgot to post the code (or else it was stripped as potentially dangerous content). As to how to execute a sproc, any standard asp.net/ado.net will work. There are a few core helper methods, one of which is called DAL+, that might be a good option - http://adefwebserver.com/dotNetNukeHE... (page 2 is the relevant page) and http://adefwebserver.com/dotNetNukeHE... should help you

Cathal


Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
New Post
1/24/2010 12:47 PM
 

 Hello Cathal,

 

You are right, I did forget to post the code I had mentioned as being below, apologies for that.  However, following your response I read, again, the wonderful site from Mr Washington and found exactly what i was looking for.  Below are two lines of code, that grab the encrypted Id for the page, and then run an sproc using that Id.  Hopefully this will be useful to some one else.

The code below works well for me now, and I am thrilled with it.  

However, I found the intellisense suggesting that I need to build a collection of parameters and only pass that collection. And when I tried to pass an individual param, as Michael does with the SurveyId, it also failed for me, because I was passing an Int.  After quite some time trying to figure out how to debug - with W2K8 - and failing, I eventually got it working by passing a string.  Does you know of any other examples of code where I can pass other data types, or in fact, pass a collection of params of various data types.

Thanks Cathal

Mark

 

        protected void LinkButton1_Click(object sender, EventArgs e)

        {

                     

            string BoatId = Common.Utilities.UrlUtils.DecryptParameter(Request.QueryString["BoatId"]);

            lblSCRNum.Text = DotNetNuke.Data.DataProvider.Instance().ExecuteScalar("usp_MB_GetSCRNumber", BoatId).ToString();

            

        }

 


Mark Breen Ireland 1987 BMW R80 g/s
 
New Post
1/25/2010 7:51 PM
 

Im not sure what you mean, it accepts this fine

 

Dim boatid As Integer

DotNetNuke.Data.DataProvider.Instance().ExecuteScalar(

"usp_MB_GetSCRNumber", boatid)

The ExecuteScalar method accepts a paramlist, and can return either an object, which you can then cast to your type of choice, or else you can use the generics version e.g.

Dim

someresults = DotNetNuke.Data.DataProvider.Instance().ExecuteScalar(

someresults As List(Of String)"usp_MB_GetSCRNumber", boatid)


Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
New Post
1/26/2010 9:27 AM
 

 Hello Cathal,

 

Would you have a line or two of the sample code for the param list?  If you have it handy it would be very useful and I will post my results back, if not, not to worry.

 

I will need to try the generics version, it looks neat also, but I need to study that a little, i have read it, but have not yet written it.

 

Will post here when have something to post,

Thanks Cathal,

Mark

 


Mark Breen Ireland 1987 BMW R80 g/s
 
Previous
 
Next
HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...How best to call an sproc from a controlHow best to call an sproc from a control


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