error - incorrect syntax near '4'

  • Turn on the SQL Server Profiler and then run your app. You will get to see the exact statement that is throwing error. It will help debugging the issue.

  • ssurekha2000 (10/17/2012)


    checked the sp with jst return stmt

    also checked it with simple select stmt without parameters

    checkedd connection string

    but still when executed frm application gives the same error

    Have you checked connection string? Looks like you are not connecting to the server/database where you have made and making changes as proc with only RETURN has no character "4" inside of its body 😉

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • there is no 4 in the SP

    i even checked with select * from table1

    i am not sure where do i get it from but i found this on debugging

    ?cmdupdate.CommandText

    "4"

    ?cmdupdate

    {System.Data.SqlClient.SqlCommand}

    CommandText: "4"

    CommandTimeout: 30

    CommandType: Text {1}

    Connection: {System.Data.SqlClient.SqlConnection}

    Container: Nothing

    DesignTimeVisible: True

    Notification: Nothing

    NotificationAutoEnlist: True

    Parameters: {System.Data.SqlClient.SqlParameterCollection}

    Site: Nothing

    Transaction: Nothing

    UpdatedRowSource: Both {3}

    cmdupdate is the sqlcommand

    cmdupdate.CommandText = "4"

    CommandType.StoredProcedure = StoredProcedure {4}

    i get this on debugging the application

  • your variable in app must be geting overriden by some other value assignment. check the variable that you are using to call the proc.

  • can you post the code where you set your CommandText in application?

    It is an application issue actually, not SQL one.

    Somewhere, instead of stored proc name you use variable with value of "4"

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • Is usp_update the actual sp that you're editing? On your original post your vb is calling usp_updaterate. Nevermind I should check for more pages on a post.

    Step through your code and check the values of your variables. Also might think about prefacing the variable name with "var" so that it's easier to read and you avoid using a reserved name by accident.

    ---------------------------------------------------------------
    Mike Hahn - MCSomething someday:-)
    Right way to ask for help!!
    http://www.sqlservercentral.com/articles/Best+Practices/61537/
    I post so I can see my avatar :hehe:
    I want a personal webpage 😎
    I want to win the lotto 😀
    I want a gf like Tiffa :w00t: Oh wait I'm married!:-D

Viewing 6 posts - 16 through 20 (of 20 total)

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