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. Database & SysAdmin
  3. Database
  4. Oracle invalid character

Oracle invalid character

Scheduled Pinned Locked Moved Database
helpcsharpdatabaseoraclequestion
16 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.
  • F Firo Atrum Ventus

    Here, I've changed my code into this:

    string query = "insert into test(no, name, dob) values(" + textBox2.Text + ", '" + textBox3.Text + "', '" + textBox4.Text + "');";

    But I still got the error -ps:column no is int others are varchar

    A hidden needle is way more effective than an unsheathed sword. That is, in the hand of professionals. What about you? Just pray your enemies are blind

    _ Offline
    _ Offline
    _Damian S_
    wrote on last edited by
    #6

    Hmmm... have you tried executing your sql directly to check that it's working as you expect?

    Reminiscing just isn't what it used to be!! Booger Mobile - My bright green 1964 Ford Falcon - check out the blog here!! | If you feel generous - make a donation to Camp Quality!!

    F 1 Reply Last reply
    0
    • _ _Damian S_

      Hmmm... have you tried executing your sql directly to check that it's working as you expect?

      Reminiscing just isn't what it used to be!! Booger Mobile - My bright green 1964 Ford Falcon - check out the blog here!! | If you feel generous - make a donation to Camp Quality!!

      F Offline
      F Offline
      Firo Atrum Ventus
      wrote on last edited by
      #7

      yep, it works in sql -ps:fyi, that code works when a button is clicked. after I've changed it into showing the query it shows this insert into test(no, name, dob) values(23, 'sawqwd', '322');

      A hidden needle is way more effective than an unsheathed sword. That is, in the hand of professionals. What about you? Just pray your enemies are blind

      _ 1 Reply Last reply
      0
      • F Firo Atrum Ventus

        yep, it works in sql -ps:fyi, that code works when a button is clicked. after I've changed it into showing the query it shows this insert into test(no, name, dob) values(23, 'sawqwd', '322');

        A hidden needle is way more effective than an unsheathed sword. That is, in the hand of professionals. What about you? Just pray your enemies are blind

        _ Offline
        _ Offline
        _Damian S_
        wrote on last edited by
        #8

        Well, if the code works when the button is clicked, and the sql works if you copy/paste it into Oracle and run it directly, there must be an error in the calling of the querydef... Do you have the correct syntax, parameters, names etc?

        Reminiscing just isn't what it used to be!! Booger Mobile - My bright green 1964 Ford Falcon - check out the blog here!! | If you feel generous - make a donation to Camp Quality!!

        F 1 Reply Last reply
        0
        • _ _Damian S_

          Well, if the code works when the button is clicked, and the sql works if you copy/paste it into Oracle and run it directly, there must be an error in the calling of the querydef... Do you have the correct syntax, parameters, names etc?

          Reminiscing just isn't what it used to be!! Booger Mobile - My bright green 1964 Ford Falcon - check out the blog here!! | If you feel generous - make a donation to Camp Quality!!

          F Offline
          F Offline
          Firo Atrum Ventus
          wrote on last edited by
          #9

          Silly me, I actually only need to remove the semicolon and it works :omg:

          string query = "insert into test(no, name, dob) values(" + textBox2.Text + ", '" + textBox3.Text + "', '" + textBox4.Text + "')";

          Guess that would mean no semicolons when connecting from c# huh? :doh: It's so different from J2SE, :laugh: Thank for the assistance :)

          A hidden needle is way more effective than an unsheathed sword. That is, in the hand of professionals. What about you? Just pray your enemies are blind

          modified on Thursday, May 26, 2011 1:50 AM

          _ L J 3 Replies Last reply
          0
          • F Firo Atrum Ventus

            Silly me, I actually only need to remove the semicolon and it works :omg:

            string query = "insert into test(no, name, dob) values(" + textBox2.Text + ", '" + textBox3.Text + "', '" + textBox4.Text + "')";

            Guess that would mean no semicolons when connecting from c# huh? :doh: It's so different from J2SE, :laugh: Thank for the assistance :)

            A hidden needle is way more effective than an unsheathed sword. That is, in the hand of professionals. What about you? Just pray your enemies are blind

            modified on Thursday, May 26, 2011 1:50 AM

            _ Offline
            _ Offline
            _Damian S_
            wrote on last edited by
            #10

            Dammit... the semicolon was the first thing I was going to mention, but when I checked oracle sql syntax it was there... :sigh: Glad you got it fixed!!

            Reminiscing just isn't what it used to be!! Booger Mobile - My bright green 1964 Ford Falcon - check out the blog here!! | If you feel generous - make a donation to Camp Quality!!

            1 Reply Last reply
            0
            • F Firo Atrum Ventus

              Silly me, I actually only need to remove the semicolon and it works :omg:

              string query = "insert into test(no, name, dob) values(" + textBox2.Text + ", '" + textBox3.Text + "', '" + textBox4.Text + "')";

              Guess that would mean no semicolons when connecting from c# huh? :doh: It's so different from J2SE, :laugh: Thank for the assistance :)

              A hidden needle is way more effective than an unsheathed sword. That is, in the hand of professionals. What about you? Just pray your enemies are blind

              modified on Thursday, May 26, 2011 1:50 AM

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #11

              It is not related to the language, could be a feature of the Provider MSDAORA that you're using.

              1 Reply Last reply
              0
              • F Firo Atrum Ventus

                Silly me, I actually only need to remove the semicolon and it works :omg:

                string query = "insert into test(no, name, dob) values(" + textBox2.Text + ", '" + textBox3.Text + "', '" + textBox4.Text + "')";

                Guess that would mean no semicolons when connecting from c# huh? :doh: It's so different from J2SE, :laugh: Thank for the assistance :)

                A hidden needle is way more effective than an unsheathed sword. That is, in the hand of professionals. What about you? Just pray your enemies are blind

                modified on Thursday, May 26, 2011 1:50 AM

                J Offline
                J Offline
                jschell
                wrote on last edited by
                #12

                Firo Atrum Ventus wrote:

                Guess that would mean no semicolons when connecting from c# huh?

                Conceptually you are executing a 'statement'. That is implicit. The semi-colon is superfluous in that context. You can however construct a statement which is composed of other statements. In that case the internal statements would require a semi-colon.

                F 1 Reply Last reply
                0
                • J jschell

                  Firo Atrum Ventus wrote:

                  Guess that would mean no semicolons when connecting from c# huh?

                  Conceptually you are executing a 'statement'. That is implicit. The semi-colon is superfluous in that context. You can however construct a statement which is composed of other statements. In that case the internal statements would require a semi-colon.

                  F Offline
                  F Offline
                  Firo Atrum Ventus
                  wrote on last edited by
                  #13

                  Nah, I've tried that too. It didn't work. :confused:

                  A hidden needle is way more effective than an unsheathed sword. That is, in the hand of professionals. What about you? Just pray your enemies are blind

                  J 1 Reply Last reply
                  0
                  • F Firo Atrum Ventus

                    Nah, I've tried that too. It didn't work. :confused:

                    A hidden needle is way more effective than an unsheathed sword. That is, in the hand of professionals. What about you? Just pray your enemies are blind

                    J Offline
                    J Offline
                    jschell
                    wrote on last edited by
                    #14

                    Firo Atrum Ventus wrote:

                    Nah, I've tried that too. It didn't work.

                    You would need to post what didn't work.

                    F 1 Reply Last reply
                    0
                    • J jschell

                      Firo Atrum Ventus wrote:

                      Nah, I've tried that too. It didn't work.

                      You would need to post what didn't work.

                      F Offline
                      F Offline
                      Firo Atrum Ventus
                      wrote on last edited by
                      #15

                      Everything's the same as above except this line

                      string query = "insert into test values(" + textBox2.Text + ", `" + textBox3.Text + "`, `" + textBox4.Text + "`);";

                      changed into

                      string query = "insert into test values(" + textBox2.Text + ", `" + textBox3.Text + "`, `" + textBox4.Text + "`);select * from test";

                      A hidden needle is way more effective than an unsheathed sword. That is, in the hand of professionals. What about you? Just pray your enemies are blind

                      J 1 Reply Last reply
                      0
                      • F Firo Atrum Ventus

                        Everything's the same as above except this line

                        string query = "insert into test values(" + textBox2.Text + ", `" + textBox3.Text + "`, `" + textBox4.Text + "`);";

                        changed into

                        string query = "insert into test values(" + textBox2.Text + ", `" + textBox3.Text + "`, `" + textBox4.Text + "`);select * from test";

                        A hidden needle is way more effective than an unsheathed sword. That is, in the hand of professionals. What about you? Just pray your enemies are blind

                        J Offline
                        J Offline
                        jschell
                        wrote on last edited by
                        #16

                        The second is not a statement. It is two statements. Investigate the use of Begin/End. Do it in a SQL browser/gui first before attempting to code it in C#.

                        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