Results 1 to 2 of 2

Thread: [Resolved] [2.0] SQL data type problem

Threaded View

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    [Resolved] [2.0] SQL data type problem

    this is a wierd one but hope someone can help

    I have a stored proc which returns me nvarchar (50) - the data for this column is something like this:

    23vv54sdu4 (or whatever)

    the stored procedure works fine as I have ran it in Query Analyzer and the syntax is correct. it gives me the return value (the example data I gave above)

    in C#, I am trying to call this stored procedure however I always get this error:

    "Syntax error converting the nvarchar value '23vv54sdu4 'to a column of data type int."

    but no where have I set the parameters to data type int. Any ideas:

    Code:
    SqlParameter theCustomerIDParam = new SqlParameter("@theCustomerID", SqlDbType.Int);
    theCustomerIDParam.Value = theCustomerID;
    
    SqlParameter theReturnResult = new SqlParameter("@theReturnValue", SqlDbType.NVarChar, 50);
    theReturnResult.Direction = ParameterDirection.Output;
                    
    theSQLCommand.Parameters.Add(theCustomerIDParam);
    theSQLCommand.Parameters.Add(theReturnResult);
    
    theSQLCommand.Connection.Open();
    theSQLCommand.ExecuteNonQuery(); //error
    theSQLCommand.Connection.Close();
    Last edited by Techno; Apr 4th, 2006 at 08:55 PM.

    MVP 2007-2010 any chance of a regain?
    Professional Software Developer and Infrastructure Engineer.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width