You are not logged in.

Dear visitor, welcome to Jabaco - Community. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

RvdN

Beginner

  • "RvdN" is male
  • "RvdN" started this thread

Posts: 3

Date of registration: Aug 8th 2009

Location: The Netherlands

  • Send private message

1

Sunday, August 16th 2009, 9:07pm

Database programming

Hello,

I have very little experience with programming and none with programming a database. I would like to import a csv file using a VB example:

Private Sub StartImport
Set objConnection = CreateObject("ADODB.Connection")
Set objRecordSet = CreateObject("ADODB.Recordset")

strPathtoTextFile = "C:\Databases\"
'this specifies the pass where the csv files are located

objConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & strPathtoTextFile & ";" & _
"Extended Properties=""text;HDR=YES;FMT=Delimited"""

objRecordset.Open "SELECT * FROM PhoneList.csv", objConnection

Do Until objRecordset.EOF
Wscript.Echo "Name: " & objRecordset.Fields.Item("Name")
Wscript.Echo "Department: " & _
objRecordset.Fields.Item("Department")
Wscript.Echo "Extension: " & objRecordset.Fields.Item("Extension")
objRecordset.MoveNext
Loop

End Sub

but as expected this doesn't work at all :cursing: . Can anyone give me an example or hints how to import a csv file and (after that) how to write the records in a database which i have to create by code.

Greetings,

Ron.

birosys

Trainee

  • "birosys" is male

Posts: 48

Date of registration: Feb 9th 2009

Location: Mladenovac, Serbia

Occupation: Programming

Hobbies: Programming

  • Send private message

2

Sunday, August 16th 2009, 9:29pm

Hello RvdN

In Jabaco, you must use jdbc for database connection.

First find JDBC driver for ISAM databases, then add it to classpath.
Then look in the forum sample for other database, and just change part of code for driver initialisation.
If you have any problem, post it :)

Milan

Rate this thread
WoltLab Burning Board