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. Visual Basic
  4. Update statement

Update statement

Scheduled Pinned Locked Moved Visual Basic
questionannouncement
5 Posts 4 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
    magedhv
    wrote on last edited by
    #1

    cmd.CommandText = "update ceasrjuice set fatname = " & x & " and reglz set fatrname = " & x & " where fatname LIKE '%" & TextBox1.Text & "%' " how can i update two tables with on word according to this condition plz it's urgent

    C B 2 Replies Last reply
    0
    • M magedhv

      cmd.CommandText = "update ceasrjuice set fatname = " & x & " and reglz set fatrname = " & x & " where fatname LIKE '%" & TextBox1.Text & "%' " how can i update two tables with on word according to this condition plz it's urgent

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      It's always urgent, isn't it ? Your strings are not in quotes, only the LIKE statement is. I assume x is a string, and I assume you know that this code makes your database completely insecure, and easily destroyed by a malicious end user. Look up SQL injection attacks on this site.

      Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

      1 Reply Last reply
      0
      • M magedhv

        cmd.CommandText = "update ceasrjuice set fatname = " & x & " and reglz set fatrname = " & x & " where fatname LIKE '%" & TextBox1.Text & "%' " how can i update two tables with on word according to this condition plz it's urgent

        B Offline
        B Offline
        Bhaskar Shetty
        wrote on last edited by
        #3

        Please explain your problem in Detail, you mean to say you want to Update two different table from one command, I think it is not possbile from one line, you have to do it one by one, Or If I mis-understood your problem, then please explain clearly. Bhaskar Shetty

        M 1 Reply Last reply
        0
        • B Bhaskar Shetty

          Please explain your problem in Detail, you mean to say you want to Update two different table from one command, I think it is not possbile from one line, you have to do it one by one, Or If I mis-understood your problem, then please explain clearly. Bhaskar Shetty

          M Offline
          M Offline
          magedhv
          wrote on last edited by
          #4

          yes that's what i mean i wanna to update 2 tables with one command

          N 1 Reply Last reply
          0
          • M magedhv

            yes that's what i mean i wanna to update 2 tables with one command

            N Offline
            N Offline
            nlarson11
            wrote on last edited by
            #5

            You can't do it within one statement. You can send 2 different statements in one command by putting a semi-colon between them. Another option is to create a trigger that will update the other table for you in sql server itself...

            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