Hi,
For
VB 6, I've been using the following steps to set up access to my database:
First, you need to add the ADO components to your
VB project as follows:
Part one: Set up your project
1. Go to the Project menu - select Components:
2. Add the Microsoft ADO Data Control 6.0
3. Add any other ADO controls you might want to use - the data grid control, combo boxes, etc.
4. You drop the ADO control onto a form. The text should read ADODC in the control when you drop it on the page.
To set up the connection to the database:
Part 2: Set up your Database or DSN connection
Then you have to set up the connection to the database. You can build a connection string, or use a DSN. To build a string (I have not used the DSN steps) you should click on the ADO control that you have dropped on the form, and in the properties window, click
1. Connection string...
2. Then select "Use connection string" and click Build.
3. Select the type of data source. For access it would be Jet and Click Next.
4. Browse to select the database (I think you have to create this first. I've never done it any other way. You can use the visual data manager, or just create the tables in your dbms of choice, i.e. access or sql server)
5. Fill in the admin name and password (or just keep the defaults to set a blank password).
6. Click Test connection to make sure you can open the connection.
Part 3: Select your recordsource
Now that you have set up your connection to the database, click on the ADO control again and select the recordsource. That's the table or SQL query you want to use as the source for your form. Whereas the ADODC references the database, this step connects you to the specific rows you need to use.
After you get all that done, then you can build sql queries, or just reference tables by using the various data controls such as the combo box control, etc.
You can use a SQL query and order by date, so that your computer stuff is sorted in chronological order.
Hope that helps to get you started.
Rachel
Quote:
quote:Originally posted by LordBeholder
Hi, I'm a beginner to VB and Databases but have some very basic knowledge. Here's the problem:
I would like to create a form (in VB) that i can use to read/write/edit fields in a database.
I'll explain what i want which may be easier.
Say for example i want to create a form with a list of my computers in a drop down list (or the like) then i can add my computers to the database, and then i want to be able to add upgrades, dates, and prices for each upgrade done for each computer and store them in the database. I don't know if there are any easier ways, but the method is not important to me as long as i can have a very simple to use form with the fields to add the computer names to it then i can add/delete/edit the various upgrades done on what date and the price, then be able to display them back in chronological order.
does that make sense?
i tried my best to explain, i would greatly appreciate it if somebody could please e-mail me with a detailed explanation on how _exactly_ i can do this or guide me to a specific tutorial with the same basic function as this. thank you very much for any help.
-=-=-=-=-=-=-=-=-=-
LordBeholdeR
|