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. Web Development
  3. ASP.NET
  4. update

update

Scheduled Pinned Locked Moved ASP.NET
helpdatabaseannouncement
9 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.
  • N Offline
    N Offline
    niki_nilu
    wrote on last edited by
    #1

    in my code i write update query like this string strSqlCmdText; strSqlCmdText = "update tUser1 set Count = "+Convert.ToInt32(txtCount.Text)+" where UserId = '"+txtUserId.Text; objClsDllSql.funSqlCmd(strSqlCmdText); but i have error ie input string is not in correct format. pls i want to update query. pls help me urgently. gayatri Gayatri

    S L P 3 Replies Last reply
    0
    • N niki_nilu

      in my code i write update query like this string strSqlCmdText; strSqlCmdText = "update tUser1 set Count = "+Convert.ToInt32(txtCount.Text)+" where UserId = '"+txtUserId.Text; objClsDllSql.funSqlCmd(strSqlCmdText); but i have error ie input string is not in correct format. pls i want to update query. pls help me urgently. gayatri Gayatri

      S Offline
      S Offline
      SHatchard
      wrote on last edited by
      #2

      strSqlCmdText = "update tUser1 set Count = "+Convert.ToInt32(txtCount.Text)+" where UserId = '"+txtUserId.Text; Change to strSqlCmdText = "update tUser1 set Count = "+Convert.ToInt32(txtCount.Text).ToString+" where UserId = '"+txtUserId.Text; Also, I should note that you are wide open to SQL injection attacks with that particular implementation. More about SQL injection attacks[^]

      N 1 Reply Last reply
      0
      • S SHatchard

        strSqlCmdText = "update tUser1 set Count = "+Convert.ToInt32(txtCount.Text)+" where UserId = '"+txtUserId.Text; Change to strSqlCmdText = "update tUser1 set Count = "+Convert.ToInt32(txtCount.Text).ToString+" where UserId = '"+txtUserId.Text; Also, I should note that you are wide open to SQL injection attacks with that particular implementation. More about SQL injection attacks[^]

        N Offline
        N Offline
        niki_nilu
        wrote on last edited by
        #3

        hello again same error. pls urgently give me reply Gayatri

        S N 2 Replies Last reply
        0
        • N niki_nilu

          hello again same error. pls urgently give me reply Gayatri

          S Offline
          S Offline
          SHatchard
          wrote on last edited by
          #4

          Can you put a watch on the sql command being executed and paste it in so i can see what command is being executed on the server?

          1 Reply Last reply
          0
          • N niki_nilu

            hello again same error. pls urgently give me reply Gayatri

            N Offline
            N Offline
            Nisar Inamdar
            wrote on last edited by
            #5

            :)Hi, Try this one.............. strSqlCmdText = "update tUser1 set Count = Convert.ToInt32 (txtCount.Text.trim().ToString()) where UserId = '"+txtUserId.Text; I think it will run properly............. Nisar Inamdar.

            1 Reply Last reply
            0
            • N niki_nilu

              in my code i write update query like this string strSqlCmdText; strSqlCmdText = "update tUser1 set Count = "+Convert.ToInt32(txtCount.Text)+" where UserId = '"+txtUserId.Text; objClsDllSql.funSqlCmd(strSqlCmdText); but i have error ie input string is not in correct format. pls i want to update query. pls help me urgently. gayatri Gayatri

              L Offline
              L Offline
              leckey 0
              wrote on last edited by
              #6

              1. Please do not use text speak. 2. Please do not use 'urgent' anywhere in your message. It's urgent for most people.

              _____________________________________________ Flea Market! It's just like...it's just like...A MINI-MALL!

              P 1 Reply Last reply
              0
              • N niki_nilu

                in my code i write update query like this string strSqlCmdText; strSqlCmdText = "update tUser1 set Count = "+Convert.ToInt32(txtCount.Text)+" where UserId = '"+txtUserId.Text; objClsDllSql.funSqlCmd(strSqlCmdText); but i have error ie input string is not in correct format. pls i want to update query. pls help me urgently. gayatri Gayatri

                P Offline
                P Offline
                peacefulmember
                wrote on last edited by
                #7

                I guess you are missing closing quote for UserID field value, probably a text field. With toString change also try to change WHERE clause from

                where UserId = '"+txtUserId.Text

                ; To

                where UserId = '"+txtUserId.Text + "'";

                P 1 Reply Last reply
                0
                • L leckey 0

                  1. Please do not use text speak. 2. Please do not use 'urgent' anywhere in your message. It's urgent for most people.

                  _____________________________________________ Flea Market! It's just like...it's just like...A MINI-MALL!

                  P Offline
                  P Offline
                  Paul Conrad
                  wrote on last edited by
                  #8

                  Shucks, do you have these "The rules" sitting on the clipboard somewheres :-D

                  "Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus

                  1 Reply Last reply
                  0
                  • P peacefulmember

                    I guess you are missing closing quote for UserID field value, probably a text field. With toString change also try to change WHERE clause from

                    where UserId = '"+txtUserId.Text

                    ; To

                    where UserId = '"+txtUserId.Text + "'";

                    P Offline
                    P Offline
                    Paul Conrad
                    wrote on last edited by
                    #9

                    You could do so, but you are open to SQL injection attacks. I'd use parameters instead...

                    "Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus

                    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