2006/11/13, Peter Eberlein <[EMAIL PROTECTED]>:
Peter Eberlein schrieb:
> Daniel Albuschat schrieb:
>> Here's the script-snippet:
>>
>>     Service = createUnoService("com.sun.star.sdb.DatabaseContext")
>
> you have to use the com.sun.star.sdbc.DriverManager for those purposes.
> In the Dev-Guide you will found how to connect with flat files.
>
may be the following will help you (not tested):

Dim mDBPropertiesText(7) As New com.sun.star.beans.PropertyValue
mDBPropertiesText(0).Name = "Extension"
mDBPropertiesText(0).Value = "csv"
mDBPropertiesText(1).Name = "CharSet"
mDBPropertiesText(1).Value = "System"
mDBPropertiesText(2).Name = "FixedLength"
mDBPropertiesText(2).Value = false
mDBPropertiesText(3).Name = "HeaderLine"
mDBPropertiesText(3).Value = false
mDBPropertiesText(4).Name = "FieldDelimiter"
mDBPropertiesText(4).Value = ","
mDBPropertiesText(5).Name = "StringDelimiter"
mDBPropertiesText(5).Value = ""
mDBPropertiesText(6).Name = "DecimalDelimiter"
mDBPropertiesText(6).Value = ""
mDBPropertiesText(7).Name = "ThousandDelimiter"
mDBPropertiesText(7).Value = ""

sDatabaseURL = "sdbc:flat:"  & "file:///x:/MyFile.csv"
oEnvironment = createUnoService("com.sun.star.sdbc.DriverManager")
oConnection =
oEnvironment.getConnectionWithInfo(sDatabaseURL,mDBPropertiesText())

This works perfectly! Thanks a bunch.
I'm very sorry I have to ask another -- this time more stupid -- question :-)
A CSV-files has no tables, so how do I create an SQL-statement to select from?
Or - what's the way to iterate thru the datasets, if not using createStatement/
executeQuery?

Daniel

--
eat(this); // delicious suicide

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to