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
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