I can't figure this out and it is driving me crazy. When I instert a string
into the database with a stored procedure, only the first letter of the string
gets inserted. Below just to test, I hard code the word "Crazy" and it will only
insert the first letter "C" I have tried other words, but only get the first letter inserted.
My datatype for the column tblUserIdParam is nvarchar(50)
Can someone help me please?
System.Guid g = new Guid(HiddenTextBox.Text.ToString());
cmdUploadDoc = new SqlCommand("UpdateEditor", theConn);
cmdUploadDoc.CommandType = CommandType.StoredProcedure;
cmdUploadDoc.Parameters.Add("@tblUserIdParam", SqlDbType.VarChar, 50);
cmdUploadDoc.Parameters.Add("@UniqueID", SqlDbType.UniqueIdentifier);
cmdUploadDoc.Parameters[0].Value = "Crazy"; // Will only insert the first letter?
cmdUploadDoc.Parameters[1].Value = g;
GO
SET QUOTED_IDENTIFIER OFF
GO
ALTER PROCEDURE [dbo].[UpdateEditor]
(
@tblUserIdParam nvarchar,
@UniqueID uniqueidentifier
-- @RowIdHidden int
)
AS
BEGIN
SET NOCOUNT ON
ALTER PROCEDURE [dbo].[UpdateEditor] ( @tblUserIdParam nvarchar(50), @UniqueID uniqueidentifier -- @RowIdHidden int in the srorproc u have nt mention the size of column as the size 50 make it fifty.
Thanks and Regards
Somnath
http://silverlightcsharp.blogspot.com
Please click “Mark as Answer” on the post if it helps you,
Marked as answer by brgdotnet on Jul 16, 2009 03:32 PM
GO
SET QUOTED_IDENTIFIER OFF
GO
ALTER PROCEDURE [dbo].[UpdateEditor]
(
@tblUserIdParam nvarchar(255), - Specify length of tblUserIdParam parameter
@UniqueID uniqueidentifier
-- @RowIdHidden int
)
AS
BEGIN
SET NOCOUNT ON
update tblTempForEditor set tblUserIdParam=@tblUserIdParam where UniqueID=@UniqueID
brgdotnet
Participant
1202 Points
724 Posts
I only get first letter inserted when I call stored proc
Jul 16, 2009 06:02 AM|LINK
I can't figure this out and it is driving me crazy. When I instert a string
into the database with a stored procedure, only the first letter of the string
gets inserted. Below just to test, I hard code the word "Crazy" and it will only
insert the first letter "C" I have tried other words, but only get the first letter inserted.
My datatype for the column tblUserIdParam is nvarchar(50)
Can someone help me please?
System.Guid g = new Guid(HiddenTextBox.Text.ToString());
cmdUploadDoc = new SqlCommand("UpdateEditor", theConn);
cmdUploadDoc.CommandType = CommandType.StoredProcedure;
cmdUploadDoc.Parameters.Add("@tblUserIdParam", SqlDbType.VarChar, 50);
cmdUploadDoc.Parameters.Add("@UniqueID", SqlDbType.UniqueIdentifier);
cmdUploadDoc.Parameters[0].Value = "Crazy"; // Will only insert the first letter?
cmdUploadDoc.Parameters[1].Value = g;
GO
SET QUOTED_IDENTIFIER OFF
GO
ALTER PROCEDURE [dbo].[UpdateEditor]
(
@tblUserIdParam nvarchar,
@UniqueID uniqueidentifier
-- @RowIdHidden int
)
AS
BEGIN
SET NOCOUNT ON
update tblTempForEditor set tblUserIdParam=@tblUserIdParam where UniqueID=@UniqueID
END
Som Nath Shu...
Contributor
3289 Points
541 Posts
Re: I only get first letter inserted when I call stored proc
Jul 16, 2009 06:06 AM|LINK
ALTER PROCEDURE [dbo].[UpdateEditor] ( @tblUserIdParam nvarchar(50), @UniqueID uniqueidentifier -- @RowIdHidden int in the srorproc u have nt mention the size of column as the size 50 make it fifty.
Somnath
http://silverlightcsharp.blogspot.com
Please click “Mark as Answer” on the post if it helps you,
chintanpshah
All-Star
19058 Points
3273 Posts
Re: I only get first letter inserted when I call stored proc
Jul 16, 2009 06:25 AM|LINK
Specify parameter lenght in SP.
GO
SET QUOTED_IDENTIFIER OFF
GO
ALTER PROCEDURE [dbo].[UpdateEditor]
(
@tblUserIdParam nvarchar(255), - Specify length of tblUserIdParam parameter
@UniqueID uniqueidentifier
-- @RowIdHidden int
)
AS
BEGIN
SET NOCOUNT ON
update tblTempForEditor set tblUserIdParam=@tblUserIdParam where UniqueID=@UniqueID
END
My Software Website
brgdotnet
Participant
1202 Points
724 Posts
Re: I only get first letter inserted when I call stored proc
Jul 16, 2009 03:33 PM|LINK
Thanks guys! I appreciate it. I need some rest. Thanks