Login
Register
17-05-2008

Resources for the DotNetNuke Community
Join WebHost4Life.com
Support this site

  Support forums  

You need to be logged in in order to post to this forums.
SearchForum Home
  DotNetNuke Development  HelloWorld Tutorial  How do I create...
 How do I create Get [modulename] ByModules Sp?
 
imgOfflinejordanbaumgardner
2 posts
Joined
1/24/2006

How do I create Get [modulename] ByModules Sp?
Posted: 30 Jan 06 6:19 AM

I know this is a newbie question, I've read the turtorial several times, and I'm really missing something. I feel like I'm SOOO close!

Ive got everything setup, but when it runs I get the following error message:

The stored procedure 'dbo.GetGroupContactMgrByModules' doesn't exist. ---> System.InvalidOperationException: The stored procedure 'dbo.GetGroupContactMgrByModules' doesn't exist.

I look in the database and its not there.

Where/How/When does

public abstract IDataReader ListGroupContactMgr();

public abstract IDataReader GetGroupContactMgrByModules(int ModuleId);

public abstract IDataReader GetGroupContactMgr(int ItemID, int ModuleId);

public abstract int AddGroupContactMgr(int ModuleId, string Field1);

public abstract void UpdateGroupContactMgr(int ItemId, string Field1);

public abstract void DeleteGroupContactMgr(int ItemID);

SP's get created? Do I write them myself? Did I miss a CodeSmith template somewhere? I looked carefuly in the CodeSmith StoredProcedure template and could find no reference to ByModules or any of the others.

Thanks in advance!

 

 

 

 

imgOfflinednnjungle
141 posts
5th
Joined
3/13/2005

Re: How do I create Get [modulename] ByModules Sp?
Posted: 02 Feb 06 1:30 AM

Jordan,

the cs stored procedures template will create all base stored procedures for any given table (add, get, list, delete, update). AND if the table has any relationship to any other one it will also build the GetBy..  stored procedures based on the defined foreing keys. If you did not define that relation the stored proc will not be created.

Take a look at the helloworld tutorial, it's explained there.


Disgrafic.com
imgOfflinejordanbaumgardner
2 posts
Joined
1/24/2006

Re: How do I create Get [modulename] ByModules Sp?
Posted: 02 Feb 06 8:42 AM

First, thank you so much for the reply.

I think I'm really missing something here..

I ran the cs stored procedure template, and I did get SP's for my table.

But...

It (the code created from the dnnJungle project template) wants to call a SP called: GetGroupContactmgrByModuleID. Now GroupContractMgr is NOT a table, but the name of my PA or module name.

Did I just screw up when I created the project? or is there something that creates this SP?

The other modules don't seem to have this SP either, so I'm beginning to think I screwed up somewhere.

Here is the code generated from the CodeSmith Templates. These have Coresponding SP's.

#region "GCM_Contacts Abstract Methods"
public abstract IDataReader GetGCM_Contacts(int gcnID);
public abstract IDataReader ListGCM_Contacts();
public abstract IDataReader GetGCM_ContactsByModules(int moduleID );
public abstract int AddGCM_Contacts(int gcnModuleID , string gcnFirstName , string gcnLastNanme);
public abstract void UpdateGCM_Contacts(int gcnID, int gcnModuleID , string gcnFirstName , string gcnLastNanme);
public abstract void DeleteGCM_Contacts(int gcnID);
#endregion

But .. I also get:
public abstract IDataReader ListGroupContactMgr();
public abstract IDataReader GetGroupContactMgrByModules(int ModuleId);
public abstract IDataReader GetGroupContactMgr(int ItemID, int ModuleId);
public abstract int AddGroupContactMgr(int ModuleId, string Field1);
public abstract void UpdateGroupContactMgr(int ItemId, string Field1);
public abstract void DeleteGroupContactMgr(int ItemID);

These have my Module Name in them, NOT the table. Get[GroupContactMgr]ByModules for example. GroupContactMgr is my Module or PA.

So just to be clear... When you did the Hello world example.. Did you get an
GetHelloWorldByModules SP? If so, can I see it? and where did you get it? (who/what generated it?)

And I will re-read the tutorial again. Thanks in advance.

 

 

 

imgOfflinednnjungle
141 posts
5th
Joined
3/13/2005

Re: How do I create Get [modulename] ByModules Sp?
Posted: 02 Feb 06 9:25 AM

Here it is:

SET QUOTED_IDENTIFIER ON

GO

SET ANSI_NULLS OFF

GO

CREATE PROCEDURE {databaseOwner}{objectQualifier}VMasanas_HelloWorldGetByModules

@moduleID int

AS

SELECT

[itemID],

[moduleID],

[message]

FROM {objectQualifier}VMasanas_HelloWorld

WHERE

[moduleID]=@moduleID

GO

SET QUOTED_IDENTIFIER OFF

GO

SET ANSI_NULLS ON

GO

Also generated from the templates you should get:

in Sqldataprovider.vb

Public Overrides Function GetHelloWorldByModules(ByVal moduleID As Integer ) As IDataReader

Return CType(SqlHelper.ExecuteReader(ConnectionString, DatabaseOwner & ObjectQualifier & "VMasanas_HelloWorldGetByModules", moduleID), IDataReader)

End Function

in Dataprovider.vb:

Public MustOverride Function GetHelloWorldByModules(ByVal moduleID As Integer ) As IDataReader

in controller file:

Public Function GetByModules(ByVal moduleID As Integer ) As ArrayList

Return CBO.FillCollection(DataProvider.Instance().GetHelloWorldByModules(moduleID), GetType(HelloWorldInfo))

End Function


Disgrafic.com
  DotNetNuke Development  HelloWorld Tutorial  How do I create...
© Vicenç Masanas Terms Of Use Privacy Statement   
.