Calling stored procedures using objectdatasource and Enterprise li

  • Thread starter Thread starter Alex. O. Koranteng
  • Start date Start date
A

Alex. O. Koranteng

I am getting error shown below when the page loads. I have referenced the
Microsoft Enterprise library but I am not sure which version I am pointing
to. I have both Version 2.0 and 3.1 loaded on my machine. Any suggestions
will help and will email zipped sample file if required.


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: CS0117:
'Microsoft.Practices.EnterpriseLibrary.Data.Database' does not contain a
definition for 'GetSprocCommand'

Source Error:



Line 45:
Line 46:
Line 47: dbCommand =
Northwind.GetSprocCommand("sp_UpdateCustomerEntLib");
Line 48: Northwind.ExecuteNonQuery(dbCommand);
Line 49: }


Source File: c:\Netforums\Codeproject\GridviewObjectDataSrc_src -
Sprocs\App_Code\BizLayer.cs Line: 47
 
Hi Alex,
Compiler Error Message: CS0117:
'Microsoft.Practices.EnterpriseLibrary.Data.Database' does not contain a
definition for 'GetSprocCommand'

Do you want to call a stored procedure? If so please try:

dbCommand =
Northwind. GetStoredProcCommand("sp_UpdateCustomerEntLib");

You can refer to following documentation for more details:

http://msdn.microsoft.com/en-us/library/cc309176.aspx

Please let me know if it works and feel free to ask if you have further
questions.

Regards,
Allen Chen
Microsoft Online Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hi Alex,
Compiler Error Message: CS0117:
'Microsoft.Practices.EnterpriseLibrary.Data.Database' does not contain a
definition for 'GetSprocCommand'

Do you want to call a stored procedure? If so please try:

dbCommand =
Northwind. GetStoredProcCommand("sp_UpdateCustomerEntLib");

You can refer to following documentation for more details:

http://msdn.microsoft.com/en-us/library/cc309176.aspx

Please let me know if it works and feel free to ask if you have further
questions.

Regards,
Allen Chen
Microsoft Online Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Sloan,

Thanks for the links. I attempted to access them by clicking on the links
but they do not work.
 
Sloan,

Thanks for the links. I attempted to access them by clicking on the links
but they do not work.
 
Allen,

Thanks for the response. I have used the syntax you showed me but could not
get it to work. I read on the link you pointed me to but to no avail. I was
thinking of adding references to Microsoft Enterprsie library but could not
get intellisense to work. I will email you my project file next
 
Allen,

Thanks for the response. I have used the syntax you showed me but could not
get it to work. I read on the link you pointed me to but to no avail. I was
thinking of adding references to Microsoft Enterprsie library but could not
get intellisense to work. I will email you my project file next
 
Hi Alex,
Thanks for the response. I have used the syntax you showed me but could not
get it to work. I read on the link you pointed me to but to no avail. I was
thinking of adding references to Microsoft Enterprsie library but could not
get intellisense to work. I will email you my project file next

Have you sent me your project?

Regards,
Allen Chen
Microsoft Online Support
 
Hi Alex,
Thanks for the response. I have used the syntax you showed me but could not
get it to work. I read on the link you pointed me to but to no avail. I was
thinking of adding references to Microsoft Enterprsie library but could not
get intellisense to work. I will email you my project file next

Have you sent me your project?

Regards,
Allen Chen
Microsoft Online Support
 
Allen,

I will send you the sample tomorrow. I do not want to send too many files at
a time to confuse things. Thanks a lot for all your efforts.
 
Allen,

I am emailing you the reuquested solution prject file as requested to your
inbox. I have listed below the 2 SPROCS I used and thanks a lot.

USE [Northwind]
GO
/****** Object: StoredProcedure [dbo].[CustomerList1] Script Date:
06/08/2009 06:08:51 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[CustomerList1]
AS
SELECT CustomerID, CompanyName,ContactName FROM Customers


USE [Northwind]
GO
/****** Object: StoredProcedure [dbo].[spUpdateCustomerEntLib] Script
Date: 06/08/2009 06:10:10 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[spUpdateCustomerEntLib]
@CustId nchar(5),
@CmpyNm nvarchar(40),
@CtctNm nvarchar(30)

AS
UPDATE Customers
SET CompanyName = @CmpyNm,
ContactName = @CtctNm

WHERE CustomerID = @CustID

RETURN
 
Allen,

I have implemented your code suggestion and have set the Autogenerate
property to false as recommended. The gridview is still not loading the
records as expected when the page initially loads. I have emailed my latest
version to you inbox.

Thanks

Alex. O. Koranteng said:
Allen,

I am emailing you the reuquested solution prject file as requested to your
inbox. I have listed below the 2 SPROCS I used and thanks a lot.

USE [Northwind]
GO
/****** Object: StoredProcedure [dbo].[CustomerList1] Script Date:
06/08/2009 06:08:51 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[CustomerList1]
AS
SELECT CustomerID, CompanyName,ContactName FROM Customers


USE [Northwind]
GO
/****** Object: StoredProcedure [dbo].[spUpdateCustomerEntLib] Script
Date: 06/08/2009 06:10:10 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[spUpdateCustomerEntLib]
@CustId nchar(5),
@CmpyNm nvarchar(40),
@CtctNm nvarchar(30)

AS
UPDATE Customers
SET CompanyName = @CmpyNm,
ContactName = @CtctNm

WHERE CustomerID = @CustID

RETURN


Alex. O. Koranteng said:
Allen,

I will send you the sample tomorrow. I do not want to send too many files at
a time to confuse things. Thanks a lot for all your efforts.
 
Back
Top