CSIT Forum

Forum under construction. You can go to our fanpage in facebook to be updated. Thanks!

Join the forum, it's quick and easy

CSIT Forum

Forum under construction. You can go to our fanpage in facebook to be updated. Thanks!

CSIT Forum

Would you like to react to this message? Create an account in a few clicks or log in to continue.
CSIT Forum

This forum was made for the CSIT students of Asian College of Science and Technology. Season Greetings from the Admin and moderators.

OMG! This site was abondoned since. I dunno. Hope it will operate normally soon.

    Advance VB 6.0

    mtheaven
    mtheaven


    Posts : 1
    Points : 3
    Reputation : 0
    Join date : 2010-02-23
    Age : 36
    Location : Philippines

    Advance VB 6.0 Empty Advance VB 6.0

    Post  mtheaven Tue Feb 23, 2010 12:32 pm

    This is my tutorial on setting up a database...


    1.)
    Make the following forms:

    Form1
    Module1

    2.)
    You also need the following components:

    ----Microsoft ADO Data Controls 6.0 (OLEDB)

    after adding the component, you need to insert that component to the form...


    3.)
    Type this on your module...

    Public rs = new ADODB.Recordset

    Public Function cnx() as ADODB.Connection
    Set cnx = New ADODB.Connection
    cnx.CursorLocation = adUseClient
    cnx.Open 'Datasource here...
    End Function

    4.)
    To get the datasource, insert ADODC to your form. Next, click on the build. If you are using MS Access for your database, use Microsoft Jet 4.0 OLE DB Provider and select your database.
    Use Microsoft OLE DB Provider for SQL Server if you are using SQL Server..

    ..then click Ok.

    Copy the code in the connection string and paste it on your module in the datasource and do it like this:

    cnx.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=master"

    ..with the quotations on.

    Well.. that's about it on the connection!. ^_^



    5.)
    Before we do anything, we need to add a record in the database. Create a table named tblSample and 2 fields for ID and Name.

    6.)
    Next is we add 2 text boxes in our form. Name them as txtID and txtName.

    7.)
    Add this code in the form load.

    Private Sub Form_Load()
    Set rs = new ADODB.Recordset
    rs.Open "SELECT * FROM tblSample", cnx, 3, 3
    With rs
    txtID.Text = !ID
    txtName.Text = !Name
    End With
    End Sub



    8.)

    Run your program!.. XD
    Enjoy! ^_^

      Current date/time is Fri May 17, 2024 9:51 am