473,497 Members | 2,190 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

I have an sql stored procedure that gives an error when executed in Management Studio

3 New Member
@ContractStateCode, @ContactZipCode @BillingStateCode, @BillingZipCode show "not a parameter for procedure SelectDonorXiD".
The Results show the selected data but the parameters are all null.

My C# ocde -
Expand|Select|Wrap|Line Numbers
  1.  DataView dvSql = (DataView)sdsEditDonor.Select(DataSourceSelectArguments.Empty);
gives - "String[1]: the Size property has an invalid size of 0."

I understand that something is wrong with my stored procedure but for the life of me I cannot see what.

Please help?
Expand|Select|Wrap|Line Numbers
  1. Table ------
  2. USE [char68003f]
  3. GO
  4. /****** Object:  Table [dbo].[GFA_Donors]    Script Date: 09/01/2010 19:44:37 ******/
  5. IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[GFA_Donors]') AND type in (N'U'))
  6. DROP TABLE [dbo].[GFA_Donors]
  7. GO
  8. USE [char68003f]
  9. GO
  10.  
  11. /****** Object:  Table [dbo].[GFA_Donors]    Script Date: 09/01/2010 19:44:38 ******/
  12. SET ANSI_NULLS ON
  13. GO
  14. SET QUOTED_IDENTIFIER ON
  15. GO
  16. SET ANSI_PADDING ON
  17. GO
  18. CREATE TABLE [dbo].[GFA_Donors](
  19.     [DonorID] [int] IDENTITY(1,1) NOT NULL,
  20.     [ContactTitle] [varchar](7) NULL,
  21.     [ContactFirstName] [varchar](40) NULL,
  22.     [ContactLastName] [varchar](40) NULL,
  23.     [ContactAddress1] [varchar](40) NULL,
  24.     [ContactAddress2] [varchar](40) NULL,
  25.     [ContactCity] [varchar](30) NULL,
  26.     [ContactStateCode] [varchar](2) NULL,
  27.     [ContactZipCode] [varchar](10) NULL,
  28.     [ContactPhone] [varchar](30) NULL,
  29.     [ContactEmail] [varchar](80) NULL,
  30.     [BillingTitle] [varchar](7) NULL,
  31.     [BillingFirstName] [varchar](40) NULL,
  32.     [BillingLastName] [varchar](40) NULL,
  33.     [BillingAddress1] [varchar](40) NULL,
  34.     [BillingAddress2] [varchar](40) NULL,
  35.     [BillingCity] [varchar](30) NULL,
  36.     [BillingStateCode] [varchar](2) NULL,
  37.     [BillingZipCode] [varchar](10) NULL,
  38.     [BillingPhone] [varchar](30) NULL,
  39.     [BillingEmail] [varchar](80) NULL,
  40.     [BillStartDate] [smalldatetime] NOT NULL,
  41.     [CCExpire] [varchar](7) NOT NULL,
  42.     [CreditCardNo] [varchar](16) NOT NULL,
  43.     [DonationAmount] [money] NULL,
  44.     [DonationPreference] [varchar](10) NULL,
  45.     [PrivacyPreference] [varchar](20) NULL,
  46.     [DesignationCause] [varchar](50) NULL,
  47.     [GiftOrDedication] [varchar](50) NULL,
  48.     [SubscriptionID] [int] NULL,
  49.     [Comment] [varchar](255) NULL,
  50.     [BlockMailings] [bit] NULL,
  51.     [NewsLetter] [bit] NULL,
  52.     [DateAdded] [datetime] default getdate(),
  53.     [DateUpdated] [datetime] default getdate()
  54. ,
  55.     [anonymous] [bit] NULL,
  56.     [Active] [bit] NULL,
  57.  CONSTRAINT [PK__persons__09DE7BCC] PRIMARY KEY CLUSTERED 
  58. (
  59.     [DonorID] ASC
  60. )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
  61. ) ON [PRIMARY]
  62. GO
  63. SET ANSI_PADDING OFF
  64. GO
  65. ALTER TABLE [dbo].[GFA_Donors] ADD  CONSTRAINT [DF_GFA_Donors_BillingStartDate]  DEFAULT (((7)/(13))/(1944)) FOR [BillStartDate]
  66. GO
  67. ALTER TABLE [dbo].[GFA_Donors] ADD  CONSTRAINT [DF_GFA_Donors_CCExipre]  DEFAULT ((7)/(1944)) FOR [CCExpire]
  68. GO
  69. ALTER TABLE [dbo].[GFA_Donors] ADD  CONSTRAINT [DF_GFA_Donors_CreditCardNo]  DEFAULT ('xxxxxxxxxxxx5555') FOR [CreditCardNo]
  70. GO
  71. ALTER TABLE [dbo].[GFA_Donors] ADD  CONSTRAINT [DF_GFA_Donors_Active]  DEFAULT ((1)) FOR [Active]
  72. GO
  73.  
  74. Stored PROC---------------
  75. USE [char68003f]
  76. GO
  77. /****** Object:  StoredProcedure [dbo].[SelectDonorXiD]    SET ANSI_NULLS ON
  78. GO
  79. SET QUOTED_IDENTIFIER ON
  80. GO
  81. ALTER PROCEDURE [dbo].[SelectDonorXiD]
  82.     (
  83.     @DonorID varchar(50) ,
  84.     @ContactTitle varchar(7)=null OUTPUT,
  85.     @ContactFirstName varchar(40)=null OUTPUT,
  86.     @ContactLastName varchar(40)=null OUTPUT,
  87.     @ContactAddress1 varchar(40)=null OUTPUT,
  88.     @ContactAddress2 varchar(40)=null OUTPUT,
  89.     @ContactCity varchar(30)=null OUTPUT,
  90.     @ContactStateCode varchar(2)=null OUTPUT,
  91.     @ContactZipCode varchar(10)=null OUTPUT,
  92.     @ContactPhone varchar(30)=null OUTPUT,
  93.     @ContactEmail varchar(80)=null OUTPUT,
  94.     @BillingTitle varchar(7)=null OUTPUT,
  95.     @BillingFirstName varchar(40)=null OUTPUT,
  96.     @BillingLastName varchar(40)=null OUTPUT,
  97.     @BillingAddress1 varchar(40)=null OUTPUT,
  98.     @BillingAddress2 varchar(40)=null OUTPUT,
  99.     @BillingCity varchar(30)=null OUTPUT,
  100.     @BillingStateCode varchar(2)=null OUTPUT,
  101.     @BillingZipCode varchar(10)=null OUTPUT,
  102.     @BillingPhone varchar(30)=null OUTPUT,
  103.     @BillingEmail varchar(80)=null OUTPUT
  104.     )
  105. AS
  106.     Select ContactTitle, ContactFirstName, ContactLastName, ContactAddress1, ContactAddress2, ContactCity, ContactStateCode, ContactEmail, ContactPhone, ContactZipCode,BillingTitle,BillingFirstName,BillingLastName, BillingAddress1, BillingAddress2,BillingCity,BillingStateCode, BillingEmail, BillingPhone, BillingZipCode
  107.         From GFA_Donors Where @DonorID = DonorID
  108.     RETURN
Sep 2 '10 #1
5 1473
Jerry Winston
145 Recognized Expert New Member
When are you getting the error?
Sep 2 '10 #2
jmaxsides
3 New Member
"String[1]: the Size property has an invalid size of 0."
takes place on DataView dvSql = (DataView)sdsEditDonor.Select(DataSourceSelectArgu ments.Empty);

I went to SQL Management Studio to see if the stored procedure would actually run. In Management Studio I execute the Stored Procedure and get - @ContractStateCode, @ContactZipCode @BillingStateCode, @BillingZipCode show "not a parameter for procedure SelectDonorXiD".

If I can get by the error in Management Studio I think the C# code will work.

Thanks..
Sep 2 '10 #3
Jerry Winston
145 Recognized Expert New Member
I don't know if this is a typo here or in your executing code, but I think you've mislabled a field somewhere in your code.

Expand|Select|Wrap|Line Numbers
  1. @ContractStateCode
is not a valid parameter. however
Expand|Select|Wrap|Line Numbers
  1. @ContactStateCode
is a parameter.
Sep 7 '10 #4
jmaxsides
3 New Member
Resolved but not full understood. I had to give the parameters for the SQLDataSource a lenght attribute? ie @contactstatecode(2)...
Sep 7 '10 #5
mzmishra
390 Recognized Expert Contributor
I think the problem was with your output paramter. you may be setting different datatype to your input parameter in code and storedprocedure.
Sep 7 '10 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

4
1590
by: D Witherspoon | last post by:
I have a Structure I have created and am using it as a Public Property of a class. Here is the property. ------------------------------------------------------ Dim _MyID As SInteger Public...
7
7745
by: bajwa | last post by:
Hi Our SQL server has a lot of stored procedures and we want to get some cleaning up to be done. We want to delete the ones that have been not run for like 2-3 months. How exactly will i find out...
2
5710
by: Caro | last post by:
I have a stored procedure spGetAccessLogDynamic and when I try to call it I get the following error: Server: Msg 2812, Level 16, State 62, Line 1 Could not find stored procedure 'S'. I dont...
1
9689
by: Raquel | last post by:
This is a stored procedure that resides on Mainframe and gets executed on the client by connecting to the mainframe through DB2 connect. It was executing fine till yesterday when I executed a table...
0
1415
by: athos | last post by:
Previously, we could use Visual Studio .Net 2002 combined with Visual SourceSafe 6.0 to maintain version control for Stored Procedures. (refer to "How to add SQL Server 2000 Stored Procedures to...
1
2627
by: singhneeta | last post by:
Hi all, I have a funny issue. I have a stored procedure that opens up as a datasheet. User can use the filter by selection option in Access to filter records. For some reson, some of the columns...
1
2532
by: Crazy Cat | last post by:
I'm calling several SQL Server 2005 stored procedures from Visual Basic 2005. I've got one stored procedure that locks up at the same point everytime, but if I copy the stored procedure from the...
0
1146
by: Sean | last post by:
When trying to debug using Visual Studio 2005 I get Unable to start debugging on the web server. An authentication error occurred while communicating with the web server. Please see Help for...
1
2314
by: %NAME% | last post by:
I tried to compile a stored procedure on DB2 v7.0 on Solaris. The procedure is very simple as below: CREATE PROCEDURE fullamount(OUT fullamnt DOUBLE) language SQL READS SQL DATA BEGIN ...
2
2190
by: subhala | last post by:
im getting an error when installing visual studio 6 in window xp.here is the error "set up is updating the system".then DCOM user account cannot register c:\program...
0
6991
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
6878
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7373
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4897
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4583
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1405
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
649
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
286
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.