Server Error in '/' Application.

Invalid length parameter passed to the RIGHT function.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Invalid length parameter passed to the RIGHT function.

Source Error:


Line 777:            con.Open()
Line 778:            cmd.Parameters.AddWithValue("@String", ProductSearch)
Line 779:            Dim a As Integer = Convert.ToInt16(cmd.ExecuteScalar())
Line 780:            con.Close()
Line 781:            Return a

Source File: D:\InetPub\vhosts\rehabedge.com\httpdocs\App_Code\ManageUserData.vb    Line: 779

Stack Trace:


[SqlException (0x80131904): Invalid length parameter passed to the RIGHT function.]
   System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +1968874
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4907547
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194
   System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2412
   System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +59
   System.Data.SqlClient.SqlDataReader.get_MetaData() +83
   System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +293
   System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +954
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +162
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +32
   System.Data.SqlClient.SqlCommand.ExecuteScalar() +139
   ManageUserData.NewRehab_GetCountAllProductSearched(String ProductSearch) in D:\InetPub\vhosts\rehabedge.com\httpdocs\App_Code\ManageUserData.vb:779
   ProductSearch.BindTheData() in D:\InetPub\vhosts\rehabedge.com\httpdocs\ProductSearch.aspx.vb:46
   ProductSearch.Page_Load(Object sender, EventArgs e) in D:\InetPub\vhosts\rehabedge.com\httpdocs\ProductSearch.aspx.vb:25
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   System.Web.UI.Control.LoadRecursive() +50
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627


Version Information: Microsoft .NET Framework Version:2.0.50727.8974; ASP.NET Version:2.0.50727.8975