Tables, queries, and database with Visual Basic 6

5 pts.
Tags:
Database connectivity
Visual Basic
Visual Basic 6
hi i am developing a visual basic application with (vb6.0)and have the following questions,1. how will i add a table in my application and then use one column to be getting data from another table. 2. can i make a query in .mdb and then run it in visual basic.how will i do it if its possible, i have connected to my database (using data environment)and i cant navigate the records.

Answer Wiki

Thanks. We'll let you know when a new response is added.

1) <b>Usually</b>, you add tables to your database at design time, not at runtime from the application. You can read and insert/update data into the database with SQL.
2) Are you using Access ? what version ? are you getting some error when trying to navigate the records ?

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Vatchy
    In general, this is how you create a database in code:
    'Define some variables:
        Dim CatDBTest As Database
        Dim CatDBTableDefCategory As TableDef
        Dim CatIdx As Index
        Dim msgCancel As String
    
        Set CatDBTest = CreateDatabase({catalog name}, dbLangGeneral)   'create the actual MDB file
    
    'Create a table:
        Set CatDBTableDefCategory = CatDBTest.CreateTableDef("Category")
            With CatDBTableDefCategory
                .Fields.Append .CreateField("Category", dbText)
            End With
    
        CatDBTest.TableDefs.Append CatDBTableDefCategory
    
    'Create a key:
        With CatDBTableDefCategory
            Set CatIdx = .CreateIndex("Key")
            CatIdx.Fields.Append CatIdx.CreateField("Category")
            CatIdx.Primary = True
            .Indexes.Append CatIdx
            .Indexes.Refresh
        End With
    
    That should be enough to get you started. As for queries, it is easier to create the query in VB and run it using SQL. (IMHO)
    1,410 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following