access data using visual basic 6.0 to access database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jonjon sanchez
    New Member
    • Aug 2007
    • 3

    access data using visual basic 6.0 to access database

    Hi I'm Jon


    I want to asked a help about vb6.0 access data on microsoft access database. I going to used log in form using vb, I want save several username and password in my database that distinguished the login users. I want to searched my vb to my data base the login user if its on the record. How to do that? what are the command, syntax or the steps to do it. please help me.


    Thanks
    Jon
  • Sedecrem
    New Member
    • Aug 2007
    • 4

    #2
    To access your database use the ADO data control. you use it to link the database into your project. Assuming you have the user names and passwords stored in a table in the database the rest is just a little bit of creativity.

    1. create an ADO control and connect it to the database using it's connection string property

    2. connect the ADO control to the table containing your users/passes using the controls record source property, ensure that you select cmdTable as the command type (alternatively you could access a query in the same way as this or other access objects but lets stick to tables for now)

    3. create a flexgrid Hierarchal control and set it up (row and columns amounts etc.) ready to be populated by the database table

    4. read the data from the table into the flexgrid

    5. when the user enters the user name / pass you will want to check first for the user name (that it is present in the grid) and then check that the passwords match up ( check the password in the row that is the same as the identified user name row, eg if my user is Sedecrem and a 'Sedecrem' is present on row 6 you will want to check the contents or your password box against row 6, password column). i wont go into specifics but post back if you have trouble with syntax or getting around it.

    6. as this is a security based program i would recommended putting a password on the database (in Access) so a clever user just doesn't open that to hack your program. You then would put the database password into the password property of the ADO control. also i would ensure that you make the ADO and flex grid invisible

    7. if your toolbox does not contain the controls i have mentioned you can add them to it by using Ctrl+T in VB, opening the Components dialog.

    Sedecrem

    Comment

    • nhaztieh
      New Member
      • Aug 2007
      • 13

      #3
      Re: access data using visual basic 6.0 to access database
      --------------------------------------------------------------------------------

      To access your database use the ADO data control. you use it to link the database into your project. Assuming you have the user names and passwords stored in a table in the database the rest is just a little bit of creativity.

      1. create an ADO control and connect it to the database using it's connection string property

      2. connect the ADO control to the table containing your users/passes using the controls record source property, ensure that you select cmdTable as the command type (alternatively you could access a query in the same way as this or other access objects but lets stick to tables for now)

      3. create a flexgrid Hierarchal control and set it up (row and columns amounts etc.) ready to be populated by the database table

      4. read the data from the table into the flexgrid

      5. when the user enters the user name / pass you will want to check first for the user name (that it is present in the grid) and then check that the passwords match up ( check the password in the row that is the same as the identified user name row, eg if my user is Sedecrem and a 'Sedecrem' is present on row 6 you will want to check the contents or your password box against row 6, password column). i wont go into specifics but post back if you have trouble with syntax or getting around it.

      6. as this is a security based program i would recommended putting a password on the database (in Access) so a clever user just doesn't open that to hack your program. You then would put the database password into the password property of the ADO control. also i would ensure that you make the ADO and flex grid invisible

      7. if your toolbox does not contain the controls i have mentioned you can add them to it by using Ctrl+T in VB, opening the Components dialog.
      huhu.. same prob..but i cant follow ur procedure in no. 1 wen i go to connection string property there are 3 source of connection:
      1. Use Data Link File
      2. Use ODBC Data Source Name
      3. Use Connection String

      In Use ODBC Data Source Name I chose Ms Access Database and click apply..
      please guide me i am not familiar in ADO huhu..

      Comment

      • vinci
        New Member
        • Aug 2006
        • 62

        #4
        another way to do it is by using adodb...

        1st: add a reference of adodb
        steps: Project--->Add Reference then check the Microsoft ActiveX Data
        Objects 2.5 Library

        2nd: create a connection and a recordset
        --> dim con as adodb.connectio n
        --> dim rs as adodb.recordset

        3rd: connect to the dbase
        --> con.open "Provider=Micro soft.jet.OLEDB. 4.0; data source=[ur dbase path]"

        4th: extract data using SQL eg.
        --> rs.open "Select * from tableFoundInDba se", con ,3, 3
        using the rs we can now get the data or do something with the database add/edit/delete using SQL Statements

        lastly: dont forget to close the connection and recordset
        con.close() and rs.close()

        hope this helps...

        Comment

        • jonjon sanchez
          New Member
          • Aug 2007
          • 3

          #5
          Originally posted by Sedecrem
          To access your database use the ADO data control. you use it to link the database into your project. Assuming you have the user names and passwords stored in a table in the database the rest is just a little bit of creativity.

          1. create an ADO control and connect it to the database using it's connection string property

          2. connect the ADO control to the table containing your users/passes using the controls record source property, ensure that you select cmdTable as the command type (alternatively you could access a query in the same way as this or other access objects but lets stick to tables for now)

          3. create a flexgrid Hierarchal control and set it up (row and columns amounts etc.) ready to be populated by the database table

          4. read the data from the table into the flexgrid

          5. when the user enters the user name / pass you will want to check first for the user name (that it is present in the grid) and then check that the passwords match up ( check the password in the row that is the same as the identified user name row, eg if my user is Sedecrem and a 'Sedecrem' is present on row 6 you will want to check the contents or your password box against row 6, password column). i wont go into specifics but post back if you have trouble with syntax or getting around it.

          6. as this is a security based program i would recommended putting a password on the database (in Access) so a clever user just doesn't open that to hack your program. You then would put the database password into the password property of the ADO control. also i would ensure that you make the ADO and flex grid invisible

          7. if your toolbox does not contain the controls i have mentioned you can add them to it by using Ctrl+T in VB, opening the Components dialog.

          Sedecrem
          Hi Sedecrem

          I already have a microsoft access database, can you give me a specific command or syntax to access the data base using vb

          scenario

          Microsoft access database======= ==>Visual basic program

          in access database i store several user and password.
          in visual basic i have a login form that allow the user to log the correct login and password.

          If the user enter their login id and password the visual basic search the login id and password in the access data base.

          what is the specific command,sytax or code to solve my problem.


          thanks

          Comment

          Working...