Error :System.Data.SqlClient.TdsParser.AddSqlErrorToCollection RRS feed

  • Question

  • Hi,

      I have an windows service application, which is developed in .Net 3.5 for the purpose of SMS services. The thing is, while we receive messages from mobile or device, i just upload the data in tables called inbox. but some times its working and all the time, its not working. and given the below error..!!

    ERROR :

     at System.Data.SqlClient.TdsParser.AddSqlErrorToCollection(SqlErrorCollection& temp, SqlErrorCollection& InputCollection)
       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
       at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
       at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
       at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
       at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
       at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
       at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()

    Connection String :

    private string conStr = "data source=xxxxxxxx;initial catalog=xxxxx;user id=xxxxxx;password=xxxxxxx;Connection Timeout=200;pooling=false;MultipleActiveResultSets=True";

    Coding part:

    SqlCommand cmdInsInbox = new SqlCommand("sp_smsinbox", dbCon);
                    cmdInsInbox.CommandType = CommandType.StoredProcedure;              
                    cmdInsInbox.Parameters.AddWithValue("@short_code", sDest);
                    cmdInsInbox.Parameters.AddWithValue("@mobile_no", sSource);
                    cmdInsInbox.Parameters.AddWithValue("@short_message", sMsg);
                    cmdInsInbox.Parameters.AddWithValue("@msg_count", dMsgCt);
                    cmdInsInbox.Parameters.AddWithValue("@msg_len", sMsgLen);               
                    cmdInsInbox.Parameters.AddWithValue("@action", "insert");
                    string sInboxId = cmdInsInbox.ExecuteNonQuery().ToString();

    kindly help me to resolved this issue.!!


    • Moved by Bob Beauchemin Sunday, July 21, 2013 5:35 PM Moved to best forum for SqlClient
    Sunday, July 21, 2013 9:23 AM


  • ERROR :

     at System.Data.SqlClient.TdsParser.AddSqlErrorToCollection(SqlErrorCollection& temp, SqlErrorCollection& InputCollection)

    Do you have a SqlException message associated with this error?

    Although unrelated to the problem, you should not use "sp_" as a prefix for user stored procedure names.  That is reserved for system procs.

    Dan Guzman, SQL Server MVP, http://www.dbdelta.com

    • Marked as answer by Chester Hong Sunday, July 28, 2013 4:15 PM
    Sunday, July 21, 2013 4:20 PM