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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Can you help me?

Can you help me?

Scheduled Pinned Locked Moved ASP.NET
tutorialdatabasemysqlhelpquestion
8 Posts 5 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.
  • A Offline
    A Offline
    abglorie
    wrote on last edited by
    #1

    I want some idea from your briliant mind. My dout as how to insert or update a string value using sql quries. the string value as Women's Studies Now use this Dim mystring as string = "Women's Studies" MySql = "INSERT into tblName (Dept) values ('" & mystring & "')" or MySql = "UPDATE tblName SET Dept='" & mystring & "' where dept='Womens Studies'" in above quries not working. How to possible it? Please give an example. Thanking you in advance. abglorie

    P N I J 4 Replies Last reply
    0
    • A abglorie

      I want some idea from your briliant mind. My dout as how to insert or update a string value using sql quries. the string value as Women's Studies Now use this Dim mystring as string = "Women's Studies" MySql = "INSERT into tblName (Dept) values ('" & mystring & "')" or MySql = "UPDATE tblName SET Dept='" & mystring & "' where dept='Womens Studies'" in above quries not working. How to possible it? Please give an example. Thanking you in advance. abglorie

      P Offline
      P Offline
      Parwej Ahamad
      wrote on last edited by
      #2

      What the exception are throwing ?

      /***********************/ Parwej Ahamad g.parwez@gmail.com /***********************/

      A 1 Reply Last reply
      0
      • P Parwej Ahamad

        What the exception are throwing ?

        /***********************/ Parwej Ahamad g.parwez@gmail.com /***********************/

        A Offline
        A Offline
        abglorie
        wrote on last edited by
        #3

        The exception is Incorrect syntax near 'S'. Unclosed quotation mark before the character string ''.

        1 Reply Last reply
        0
        • A abglorie

          I want some idea from your briliant mind. My dout as how to insert or update a string value using sql quries. the string value as Women's Studies Now use this Dim mystring as string = "Women's Studies" MySql = "INSERT into tblName (Dept) values ('" & mystring & "')" or MySql = "UPDATE tblName SET Dept='" & mystring & "' where dept='Womens Studies'" in above quries not working. How to possible it? Please give an example. Thanking you in advance. abglorie

          N Offline
          N Offline
          N a v a n e e t h
          wrote on last edited by
          #4

          Print the variable MySql before you execute them. You will find the error then. Also your code is open for SQL Injection. Read articles about SQL injection and change your query.

          All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

          A 1 Reply Last reply
          0
          • N N a v a n e e t h

            Print the variable MySql before you execute them. You will find the error then. Also your code is open for SQL Injection. Read articles about SQL injection and change your query.

            All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

            A Offline
            A Offline
            abglorie
            wrote on last edited by
            #5

            Please give me an example.

            N 1 Reply Last reply
            0
            • A abglorie

              Please give me an example.

              N Offline
              N Offline
              N a v a n e e t h
              wrote on last edited by
              #6

              abglorie wrote:

              Please give me an example.

              Example for ?

              All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

              1 Reply Last reply
              0
              • A abglorie

                I want some idea from your briliant mind. My dout as how to insert or update a string value using sql quries. the string value as Women's Studies Now use this Dim mystring as string = "Women's Studies" MySql = "INSERT into tblName (Dept) values ('" & mystring & "')" or MySql = "UPDATE tblName SET Dept='" & mystring & "' where dept='Womens Studies'" in above quries not working. How to possible it? Please give an example. Thanking you in advance. abglorie

                I Offline
                I Offline
                Imran Khan Pathan
                wrote on last edited by
                #7

                abglorie wrote:

                Dim mystring as string = "Women's Studies"

                Replcae "'" to "`" and insert into database. At retriving from database, Replace "`" into "'" for example Dim mystring as string = "Women's Studies" mystring =mystring.replace("'","`"); MySql = "INSERT into tblName (Dept) values ('" & mystring & "')" .......

                please don't forget to vote on the post that helped you.

                1 Reply Last reply
                0
                • A abglorie

                  I want some idea from your briliant mind. My dout as how to insert or update a string value using sql quries. the string value as Women's Studies Now use this Dim mystring as string = "Women's Studies" MySql = "INSERT into tblName (Dept) values ('" & mystring & "')" or MySql = "UPDATE tblName SET Dept='" & mystring & "' where dept='Womens Studies'" in above quries not working. How to possible it? Please give an example. Thanking you in advance. abglorie

                  J Offline
                  J Offline
                  J4amieC
                  wrote on last edited by
                  #8

                  if you use parameterised queries it solves both a) The apostrophe problem and b) the sql injection vulnerability problem.

                  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