Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. sql error

sql error

Scheduled Pinned Locked Moved C#
databasehelpquestion
10 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    michaelgr1
    wrote on last edited by
    #1

    Hello, I use dataadapter to fill datagrid (using datatable). dataAdapter = new SqlDataAdapter(selectcommand3, connectionstring); But my sql query command is too long. because i receive an error that sqlexception was unhandled (incorrect syntax near '='). But when i write another much shorter sql query it works fine. What can i do to solve it?

    N D I M 4 Replies Last reply
    0
    • M michaelgr1

      Hello, I use dataadapter to fill datagrid (using datatable). dataAdapter = new SqlDataAdapter(selectcommand3, connectionstring); But my sql query command is too long. because i receive an error that sqlexception was unhandled (incorrect syntax near '='). But when i write another much shorter sql query it works fine. What can i do to solve it?

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      Use stored procs


      only two letters away from being an asset

      M 1 Reply Last reply
      0
      • N Not Active

        Use stored procs


        only two letters away from being an asset

        M Offline
        M Offline
        michaelgr1
        wrote on last edited by
        #3

        What does it mean?

        N 1 Reply Last reply
        0
        • M michaelgr1

          What does it mean?

          N Offline
          N Offline
          Not Active
          wrote on last edited by
          #4

          You don't know what stored procedures are? :omg: :sigh:


          only two letters away from being an asset

          M 1 Reply Last reply
          0
          • N Not Active

            You don't know what stored procedures are? :omg: :sigh:


            only two letters away from being an asset

            M Offline
            M Offline
            michaelgr1
            wrote on last edited by
            #5

            No

            N 1 Reply Last reply
            0
            • M michaelgr1

              No

              N Offline
              N Offline
              Not Active
              wrote on last edited by
              #6

              Then go away and don't come back until you do. :rolleyes:


              only two letters away from being an asset

              1 Reply Last reply
              0
              • M michaelgr1

                Hello, I use dataadapter to fill datagrid (using datatable). dataAdapter = new SqlDataAdapter(selectcommand3, connectionstring); But my sql query command is too long. because i receive an error that sqlexception was unhandled (incorrect syntax near '='). But when i write another much shorter sql query it works fine. What can i do to solve it?

                D Offline
                D Offline
                Dave Kreskowiak
                wrote on last edited by
                #7

                That depends on the query. It's not really that the query is too long, but probably that the DataAdapter will only work with queries that return data from a single table with a primary key.

                A guide to posting questions on CodeProject[^]
                Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                     2006, 2007, 2008

                1 Reply Last reply
                0
                • M michaelgr1

                  Hello, I use dataadapter to fill datagrid (using datatable). dataAdapter = new SqlDataAdapter(selectcommand3, connectionstring); But my sql query command is too long. because i receive an error that sqlexception was unhandled (incorrect syntax near '='). But when i write another much shorter sql query it works fine. What can i do to solve it?

                  I Offline
                  I Offline
                  I am BATMAN
                  wrote on last edited by
                  #8

                  michaelgr1 wrote:

                  dataAdapter = new SqlDataAdapter(selectcommand3, connectionstring);

                  Did you put one too many new lines after that = statement? at most the assignment should be the next line down, you shouldn't add any space between the 2 lines.

                  R 1 Reply Last reply
                  0
                  • I I am BATMAN

                    michaelgr1 wrote:

                    dataAdapter = new SqlDataAdapter(selectcommand3, connectionstring);

                    Did you put one too many new lines after that = statement? at most the assignment should be the next line down, you shouldn't add any space between the 2 lines.

                    R Offline
                    R Offline
                    riced
                    wrote on last edited by
                    #9

                    I am BATMAN wrote:

                    at most the assignment should be the next line down

                    Not according to the language spec. You can have as many white space chars as you like including multiple newlines. :) I've just checked with a prog by adding multiple newlines - compiles without error. :)

                    Regards David R --------------------------------------------------------------- "Every program eventually becomes rococo, and then rubble." - Alan Perlis

                    1 Reply Last reply
                    0
                    • M michaelgr1

                      Hello, I use dataadapter to fill datagrid (using datatable). dataAdapter = new SqlDataAdapter(selectcommand3, connectionstring); But my sql query command is too long. because i receive an error that sqlexception was unhandled (incorrect syntax near '='). But when i write another much shorter sql query it works fine. What can i do to solve it?

                      M Offline
                      M Offline
                      mohmeh83
                      wrote on last edited by
                      #10

                      if what you say in currect you can use @"" string style: SqlCommand mySqlComm = new SqlCommand(); mySqlComm.CommandText = @" type your string here "; but I think your sql statement is incorrect. Copy your SqlCommandText and paste in in sql Query analyzer and test it. if it has not that error what you said it correct.

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups