SPROC Problem - String[1]: The Size Property Has An Invalid Size Of 0.
Mar 16, 2007
Hi folks,
Can anyone enlighten me here? I'm trying to use a SPROC which, when supplied with an int, looks up the table and returns certain columns from it. I'm using a SqlCommand, here's my codebehind:
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SqlCommand dataSource = new SqlCommand("retrieveData", new SqlConnection(dbConnString));
dataSource .CommandType = CommandType.StoredProcedure;
dataSource .Parameters.AddWithValue("id", poid);
dataSource .Parameters.AddWithValue("title", title).Direction = ParameterDirection.Output;
dataSource .Parameters.AddWithValue("creator", creator).Direction = ParameterDirection.Output;
dataSource .Parameters.AddWithValue("assignee", assignee).Direction = ParameterDirection.Output;
etc, etc...
And the SPROC:
------------------------------------------------------------------------------------------------------------------
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[retrieveData]
@id int,
@title varchar(50) OUTPUT,
@creator varchar(50) OUTPUT,
@assignee varchar(50) OUTPUT,
@contact varchar(50) OUTPUT,
@deliveryCost numeric(18,2) OUTPUT,
@totalCost numeric(18,2) OUTPUT,
@status tinyint OUTPUT,
@project smallint OUTPUT,
@supplier smallint OUTPUT,
@creationDateTime datetime OUTPUT,
@amendedDateTime datetime OUTPUT,
@locked bit OUTPUT
AS
/**SET NOCOUNT ON;
**/
SELECT
[title] AS [@title], [datetime] AS [@creationDateTime], [creator] AS [@creator], [assignee] as [@assignee],
[supplier] as [@supplier], [contact] AS [@contact], [delivery_cost] AS [@deliveryCost], [total_cost] AS [@totalCost],
[amended_timestamp] AS [@amendedDateTime], [locked] AS [@locked]
FROM purchase_orders
WHERE [id] = @id;
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
The id being passed in is definately not null, and is set to a value of an item I know exists. The resulting error is:
Exception Details: System.InvalidOperationException: String[1]: the Size property has an invalid size of 0.
Line 63: retrievePODetails.Connection.Open();
Line 64: retrievePODetails.ExecuteNonQuery();[InvalidOperationException: String[1]: the Size property has an invalid size of 0.]
System.Data.SqlClient.SqlParameter.Validate(Int32 index) +717091... ... Can anyone see anything I'm missing? Thanks,Ally
View 1 Replies
Dec 11, 2007
I am getting error to run stored procedure using executenonquery method. The Stored Procedure is having OUTPUT parameter.
ExecuteNonQuery statement is called using SqlHelper.
Error : String[18]: the Size property has an invalid size of 0
View 1 Replies
View Related
Nov 14, 2007
Using C#, SQL Server 2005, ASP.NET 2, in a web app, I've tried removing the size from parameters of type NCHAR, NVARCHAR, and VARCHAR. I'd rather just send a string and let the size of the parameter in the SP truncate any extra chars if need be. I began getting the error below, and eventually realized it happened only with output parameters, as in the code snippet below.String[3]: the Size property has an invalid size of 0. par = new SqlParameter("@BusinessEntity", SqlDbType.NVarChar); par.Direction = ParameterDirection.Output; cmd.Parameters.Add(par); cmd.ExecuteNonQuery();What's the logic behind this? Is there any way around it other than either finding out what the size should be, or assigning a size larger than would ever be needed? ThanksMike Thomas
View 6 Replies
View Related
Sep 4, 2007
I am trying to resize a database initial log file from 500M to 2M. I€™m using€?
ALTER DATABASE <DBNAME> MODIFY FILE ( NAME = <DBLOGFILENAME, SIZE = 2 ) "
And I'm getting "MODIFY FILE failed. Specified size is less than current size." I tried going into the database properties and setting the log file to 2M, but it doesn€™t keep the changes.
Any help with this process?
View 1 Replies
View Related
Nov 7, 2000
I was getting the follow error message when trying to update a
table from another table within a stored procedure:
Server: Msg 511, Level 16, State 2, Line 1
Cannot create a row of size 8455 which is greater than the allowable maximum of 8060.
The statement has been terminated.
The row size did not exceed 8060......
Also, If I make it an 'Insert' instead of an 'Update' it works.
It will Insert the data into table.
Any ideas?
Thanks.
View 1 Replies
View Related
Jun 15, 2006
I installed sql 2005 a while back. Then I recently found out my file system was fat32 (I don't understand why the hardware people did this...) and I had to convert to NTFS. Naturally the sql service no longer worked so I uninstalled inorder to reinstall now I can't reinstall it I keep getting this message
native_error=5039, msg=[Microsoft][SQL Native Client][SQL Server]MODIFY FILE failed. Specified size is less than current size.
I'll try to post the full log in a new post.
View 11 Replies
View Related
Jul 23, 2005
Hi,I am attempting a bulk copy from a c program into SQL Server 2000 usingDBLib in freeTDS 0.63 RC11 (gcc 3.4.3, RH 9). I am getting an error messagethat I cannot find any documentation on.The server is sending back the following: "Received invalid row length 2from bcp client. Minimum row size is 4."I know the row is longer 2 bytes (see below). Once this happened I created atest table and C program. See below. Anyone with any ideas?ThanksProgram output ---------------->$ ./test_bcpbcp'ing This is a test with a length of 14sentMsg 4807, Level 16, State 1Server 'CENTIVIA_10', Line 1Received invalid row length 2 from bcp client. Minimum row size is 4.done<----------------------Table ddl --------------------->CREATE TABLE [xxx] ([col2] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL) ON [PRIMARY]GO<------------------------------------Compiled using gcc ------------------->gcc -g -I/home/test_user/dev/freetds-0.63RC11/include -Wall -Wno-strict-aliasing-g -O2 -c -o test_bcp.o test_bcp.cgcc -o test_bcp test_bcp.o -L/home/test_user/lib -lsybdb<----------------------------------program source (included the msg and error handlercode) -------------------------->#include <string.h>#include <stdio.h>#include <stdlib.h>#include <sqldb.h>intsyb_msg_handler(DBPROCESS * dbproc, DBINT msgno, int msgstate, int severity,char *msgtext, char *srvname, char *procname, int line){char var_value[31];int i;char *c;if (msgno == 5701 || /* database context change */msgno == 5703 || /* language changed */msgno == 5704) { /* charset changed */if (msgtext != NULL && (c = strchr(msgtext, ''')) != NULL){i = 0;for (++c; i <= 30 && *c != '