SQL involving Visual Basic 6.0 and Microsoft Access 2000

sandmanwake

Golden Member
Feb 29, 2000
1,494
0
0
I've got a VB module which downloads information from a website, now I want to store that information into Access 2000 tables. How do I do that with VB and SQL statements? Where in VB do I place these SQL statements?

I'm assuming that first I have to specify the database source to write into; something like:
SomePointer = Path_to_Access_File. What's the correct syntax for this? Once again, where in VB do I place these SQL statements?

Then, I suppose it'll be SomePointer.Table_Name.Row = Some_Value_From_Web until I input all the data.

Anyone able to help me out?
 

BuckleDownBen

Banned
Jun 11, 2001
519
0
0
You need to go into references and add a reference to Microsoft ActiveX Data Objects (ADO). Then go to MSDN and look at an example using ADO. You'll need to find out what the connection string needs to be (tells ADO you are using Access and the location of the database). Then you open the connection to the table, add a new record, fill out the values, and update the record. You don't need to use SQL unless you want to.
 

bunker

Lifer
Apr 23, 2001
10,572
0
71
You say this module downloads data from a website. Where does it d/l it to and in what form? Is it a simple text file, comma delimited, etc..?
 

sandmanwake

Golden Member
Feb 29, 2000
1,494
0
0
This module is going to be edited with the database code as a function. As it's downloading and parsing the webpage into strings, each string will be written to the database to update it if there are any changes or if there is no current information, write new records. Below is more or less what I want happending. The arrows point to code that deal with the database that still needs to be added.


open database connection
while still parsing
{
Current code parses out a string from web page.
-->if new string is same as old string, do nothing
-->else, write parsed out string to database (update the old information), perhaps with a function call
}
close database connection
 

bunker

Lifer
Apr 23, 2001
10,572
0
71
You have to have a way to determine what table you want to insert the strings into. After that it's a pretty simple operation to insert the data. You would put the code right after you do your check on whether or not the string has changed.
 

BuckleDownBen

Banned
Jun 11, 2001
519
0
0
Just go to your favorite search and type in some of these words. VB, ADO, Access, Insert, Code, Sample. Then just copy and paste.