SQL query returning record suffixed with \r\n escape character

  • Hi,

    Today got an interesting error,while using a SELECT statement on a MS SQL server. I am returning a recordset in a DataLayer, using C#.

    The sql query is a simple SELECT statement in a string format as follow:

    string szCommand;

    string szVariable1;

    string szVariable2;

    string szVariable3;

    string szVariable4;

    szCommand = "SELECT column1, column2,";

    szCommand += " column3, column4";

    szCommand += " FROM Table WHERE column5 = @column5";

    ... (using SqlDataReader SQLReader)

    and when assigning the returned records to the variables like the following:

    szVariable1 = SQLReader.GetString(SQLReader.GetOrdinal("column1"));

    ....

    some of the variables appeare in the form of the returned value from the SQLReader suffixed by the "\r" escape character, ie: one of the field in the datatable contains "michael", but is returned as "michael\r".I checked the records in the datatable which are returned back with the escape characters, but they seem to be OK, no extra character in the particular field. There is no extra code between the assigning of the returned data from ADO to the string variable. Any idea?

    Thanks

    Ben

Viewing post 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply