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. need your help!

need your help!

Scheduled Pinned Locked Moved Database
helpdatabasetutorial
10 Posts 3 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
    meki_2118
    wrote on last edited by
    #1

    hi, I'm practicing how to use sql language in vb 6.0 via ADODC. I'm getting problem with adding a data in INSERT INTO statement. Because my code in the command buttons is just... Adodc1.RecordSource = "INSERT INTO tblname(firstname, lastname) VALUES('" & txtfname.Text & "','" & txtlname.Text & "')" but the data in the textbox are not saved in the data base... can you help me please.

    P 1 Reply Last reply
    0
    • M meki_2118

      hi, I'm practicing how to use sql language in vb 6.0 via ADODC. I'm getting problem with adding a data in INSERT INTO statement. Because my code in the command buttons is just... Adodc1.RecordSource = "INSERT INTO tblname(firstname, lastname) VALUES('" & txtfname.Text & "','" & txtlname.Text & "')" but the data in the textbox are not saved in the data base... can you help me please.

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

      Did you try with Connection object

      myConn.Execute "INSERT INTO tblname(firstname, lastname) VALUES('" & txtfname.Text & "','" & txtlname.Text & "')"

      OR also you can it with Command object OR Try your way

      Adodc1.RecordSource = "INSERT INTO tblname(firstname, lastname) VALUES('" & txtfname.Text & "','" & txtlname.Text & "')"
      Adodc1.Refresh

      Parwej Ahamad R & D with IIS 5.0/6.0

      M 1 Reply Last reply
      0
      • P Parwej Ahamad

        Did you try with Connection object

        myConn.Execute "INSERT INTO tblname(firstname, lastname) VALUES('" & txtfname.Text & "','" & txtlname.Text & "')"

        OR also you can it with Command object OR Try your way

        Adodc1.RecordSource = "INSERT INTO tblname(firstname, lastname) VALUES('" & txtfname.Text & "','" & txtlname.Text & "')"
        Adodc1.Refresh

        Parwej Ahamad R & D with IIS 5.0/6.0

        M Offline
        M Offline
        meki_2118
        wrote on last edited by
        #3

        i've tried the

        Adodc1.RecordSource = "INSERT INTO tblname(firstname, lastname) VALUES('" & txtfname.Text & "','" & txtlname.Text & "')"
        Adodc1.Refresh

        but there was an error saying "Operation is not allowed when the object is closed" . what should i do?

        A P 2 Replies Last reply
        0
        • M meki_2118

          i've tried the

          Adodc1.RecordSource = "INSERT INTO tblname(firstname, lastname) VALUES('" & txtfname.Text & "','" & txtlname.Text & "')"
          Adodc1.Refresh

          but there was an error saying "Operation is not allowed when the object is closed" . what should i do?

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

          Do you have an open connection to the database? Doesn't sound like it from that error message.

          --------------------------- Blogging about SQL, Technology and many other things

          M 1 Reply Last reply
          0
          • M meki_2118

            i've tried the

            Adodc1.RecordSource = "INSERT INTO tblname(firstname, lastname) VALUES('" & txtfname.Text & "','" & txtlname.Text & "')"
            Adodc1.Refresh

            but there was an error saying "Operation is not allowed when the object is closed" . what should i do?

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

            (1) Before going to execute any query first check your database connection is open or close. (2) Did you try with connection object :

            myConn.Execute "INSERT INTO tblname(firstname, lastname) VALUES('" & txtfname.Text & "','" & txtlname.Text & "')"

            Parwej Ahamad R & D with IIS 5.0/6.0

            M 1 Reply Last reply
            0
            • P Parwej Ahamad

              (1) Before going to execute any query first check your database connection is open or close. (2) Did you try with connection object :

              myConn.Execute "INSERT INTO tblname(firstname, lastname) VALUES('" & txtfname.Text & "','" & txtlname.Text & "')"

              Parwej Ahamad R & D with IIS 5.0/6.0

              M Offline
              M Offline
              meki_2118
              wrote on last edited by
              #6

              yup, I've tried it and it worked but I've also change my data base connection using stored procedure. Thanks for the help. :)

              P 1 Reply Last reply
              0
              • M meki_2118

                yup, I've tried it and it worked but I've also change my data base connection using stored procedure. Thanks for the help. :)

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

                I am not getting this point : "but I've also change my data base connection using stored procedure" ?

                Parwej Ahamad R & D with IIS 5.0/6.0

                M 1 Reply Last reply
                0
                • P Parwej Ahamad

                  I am not getting this point : "but I've also change my data base connection using stored procedure" ?

                  Parwej Ahamad R & D with IIS 5.0/6.0

                  M Offline
                  M Offline
                  meki_2118
                  wrote on last edited by
                  #8

                  Instead of using the ADODC. I've changed the connection to this

                  Private nameConn As ADODB.Connection
                  Private nameCMD As ADODB.Command
                  Private nameRST As ADODB.Recordset

                  Private Sub ConnectTODB()
                  Set nameConn = New ADODB.Connection

                  nameConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\meki\meki training\dbnames.mdb"
                  nameConn.Open

                  Set nameCMD = New ADODB.Command
                  Set nameCMD.ActiveConnection = nameConn
                  End Sub

                  so that the nameComm.Execute command will work.

                  P 1 Reply Last reply
                  0
                  • A Alsvha

                    Do you have an open connection to the database? Doesn't sound like it from that error message.

                    --------------------------- Blogging about SQL, Technology and many other things

                    M Offline
                    M Offline
                    meki_2118
                    wrote on last edited by
                    #9

                    how can I open the connection to the database??:confused:

                    1 Reply Last reply
                    0
                    • M meki_2118

                      Instead of using the ADODC. I've changed the connection to this

                      Private nameConn As ADODB.Connection
                      Private nameCMD As ADODB.Command
                      Private nameRST As ADODB.Recordset

                      Private Sub ConnectTODB()
                      Set nameConn = New ADODB.Connection

                      nameConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\meki\meki training\dbnames.mdb"
                      nameConn.Open

                      Set nameCMD = New ADODB.Command
                      Set nameCMD.ActiveConnection = nameConn
                      End Sub

                      so that the nameComm.Execute command will work.

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

                      Oh! Good :)

                      Parwej Ahamad R & D with IIS 5.0/6.0

                      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