SqlParameter parmTemplateTextTX = cmdUpdate.Parameters.Add("@TemplateTextTX",SqlDbType.Text,16);to this...
SqlParameter parmTemplateTextTX = cmdUpdate.Parameters.Add("@TemplateTextTX",SqlDbType.Text);and the problem was fixed.
>> >>public int fnUpdate(int pTemplatesID, string pTemplateTextTX) >>{ >>//Create the command object >>SqlCommand cmdUpdate = new SqlCommand("UP_Update_Templates",this.objConn()); >> >>//The command type is a Stored Procedure >>cmdUpdate.CommandType = CommandType.StoredProcedure; >> >>// Parameter for field 'TemplatesID' >>SqlParameter parmTemplatesID = cmdUpdate.Parameters.Add("@TemplatesID",SqlDbType.Int,4); >>parmTemplatesID.Value = pTemplatesID; >> >>// Parameter for field 'TemplateTextTX' >>SqlParameter parmTemplateTextTX = cmdUpdate.Parameters.Add("@TemplateTextTX",SqlDbType.Text,16); >>parmTemplateTextTX.Value = pTemplateTextTX; >> >>// Parameter to hold Return Value >>SqlParameter parmReturnValue = cmdUpdate.Parameters.Add("@ReturnValue",SqlDbType.Int,4); >>parmReturnValue.Direction = ParameterDirection.Output; >> >>Console.WriteLine(pTemplateTextTX); // ** FOR TESTING PURPOSES ** >> >>//Execute the Update Stored Procedure and >>//write exceptions to the console for testing purposes >> >>try >>{ >>cmdUpdate.ExecuteNonQuery(); >>} >>catch (System.Exception e) >>{ >>Console.WriteLine(e.ToString()); // ** FOR TESTING PURPOSES ** >> >>} >> >>//Save the value returned from the Stored Procedure to a memvar >>int RetVal = Convert.ToInt32(cmdUpdate.Parameters["@ReturnValue"].Value.ToString()); >> >>//Return the integer returned from the Stored Procedure >>return RetVal ; >> >>} >> >>>>
>> >>{\rtf1\ansi\ansicpg1252\uc0\deff1{\fonttbl >>{\f0\fswiss\fcharset0\fprq2 Arial;} >>{\f1\fmodern\fcharset0\fprq1 LinePrinter;} >>{\f2\froman\fcharset0\fprq2 Times (PCL6);} >>{\f3\fswiss\fcharset0\fprq2 Helv;} >>{\f4\froman\fcharset0\fprq2 Times New Roman;} >>{\f5\froman\fcharset2\fprq2 Symbol;}} >>... and much more >> >>>>
>> >>{\rtf1\ansi\ansi >> >>>>