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. General Programming
  3. C#
  4. howto insert textbox.text into access ?

howto insert textbox.text into access ?

Scheduled Pinned Locked Moved C#
databasehelptutorialquestion
7 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    string query = "Insert Into Users(username,password) values(' + "\"" txtusername.Text "\" ','"\" txtpassword.Text"\"')"; adp1 = new OleDbDataAdapter(query, conn); > firstly, is this correct ? secondly: how should i change this values(' + "\"" txtusername.Text "\" ','"\" txtpassword.Text"\"') ? it gives error ;( dont know how to modify ?

    A 1 Reply Last reply
    0
    • L Lost User

      string query = "Insert Into Users(username,password) values(' + "\"" txtusername.Text "\" ','"\" txtpassword.Text"\"')"; adp1 = new OleDbDataAdapter(query, conn); > firstly, is this correct ? secondly: how should i change this values(' + "\"" txtusername.Text "\" ','"\" txtpassword.Text"\"') ? it gives error ;( dont know how to modify ?

      A Offline
      A Offline
      albCode
      wrote on last edited by
      #2

      string query = "Insert Into Users(username,password) values('" + txtusername.Text +"','"+ txtpassword.Text+"')";

      L 1 Reply Last reply
      0
      • A albCode

        string query = "Insert Into Users(username,password) values('" + txtusername.Text +"','"+ txtpassword.Text+"')";

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

        thanks a lot ;) but how will i process this query ? :p string baglan = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source=veritabani.mdb"; conn = new OleDbConnection(baglan); conn.Open(); string query = "Insert Into Users(username,password) values('" + txtusername.Text +"','"+ txtpassword.Text+"')"; then ... what ?

        A 1 Reply Last reply
        0
        • L Lost User

          thanks a lot ;) but how will i process this query ? :p string baglan = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source=veritabani.mdb"; conn = new OleDbConnection(baglan); conn.Open(); string query = "Insert Into Users(username,password) values('" + txtusername.Text +"','"+ txtpassword.Text+"')"; then ... what ?

          A Offline
          A Offline
          albCode
          wrote on last edited by
          #4

          string baglan = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source=veritabani.mdb"; conn = new OleDbConnection(baglan); conn.Open(); string query = "Insert Into Users(username,password) values('" + txtusername.Text +"','"+ txtpassword.Text+"')"; OleDbDataAdapter da = new OleDbDataAdapter(query ,conn ); DataSet ds = new DataSet(); da.Fill(ds); conn.Close();

          L 1 Reply Last reply
          0
          • A albCode

            string baglan = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source=veritabani.mdb"; conn = new OleDbConnection(baglan); conn.Open(); string query = "Insert Into Users(username,password) values('" + txtusername.Text +"','"+ txtpassword.Text+"')"; OleDbDataAdapter da = new OleDbDataAdapter(query ,conn ); DataSet ds = new DataSet(); da.Fill(ds); conn.Close();

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

            now i get this error: syntax error in INSERT INTO statement. ? i am confused :( and probably will lose my mind :)

            E 1 Reply Last reply
            0
            • L Lost User

              now i get this error: syntax error in INSERT INTO statement. ? i am confused :( and probably will lose my mind :)

              E Offline
              E Offline
              eggsovereasy
              wrote on last edited by
              #6

              Once you get it working you really should make a method to go through the textboxes and strip out some characters. Right now you are vulnerable to a sql injection attack. If I put: bob'; delete * from user; -- I just deleted everything in the user table.

              T 1 Reply Last reply
              0
              • E eggsovereasy

                Once you get it working you really should make a method to go through the textboxes and strip out some characters. Right now you are vulnerable to a sql injection attack. If I put: bob'; delete * from user; -- I just deleted everything in the user table.

                T Offline
                T Offline
                t thomsen judoo dk
                wrote on last edited by
                #7

                eggsovereasy wrote:

                Once you get it working you really should make a method to go through the textboxes and strip out some characters.

                You should never strip out and limit the user´s possibilities. You should escape the characters instead.

                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