![]() |
|
|||||||
| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| Questions & Help Needed Post any question regarding Basic4ppc. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hi Gjoisa,
the easiest way to do it is to use a comma delimited file (for small databases). Put a table-control on the form you will be using and then create the table by adding columns to it e.g.: table1.AddCol (cString, "PlaceName", 0) and so on for each column you want to add (the syntax is under "addcol", under "table" in the helpfile) Once you have created the columns in the table you can fill it with data (see "cell" under "table" in the helpfile) Finally you save it with e.g. table1.SaveCSV, e.g. Table1.SaveCSV ("Astrology.csv", ",", True) once again the syntax is in the helpfile. The resulting file can be read by any text editor e.g. notepad. I assure you, it is very straightforward - to my mind that is what makes it so nice to work with Basic4ppc ![]() Good luck ! / Björn Edit: As always Erel succeeds in answering first - but this time your comment is shorter than mine ! ![]() |
|
|||
|
Just a question that pops into mind: is there a way to create a CSV-database, using the FileWrite method? I know I can write a comma after each entry but in the textmode each entry takes up a line. I want to see the data after one another in textmode (as if opened by a texteditor). Is that possible?
|
|
|||
|
Hi Stellarefox,
I think so, these lines write 10 lines in three columns, separated by a comma. Is that what you were asking for? FileOpen(c1,AppPath&"\test.csv",cWrite) For i=0 To 10 FileWrite(c1,"This is record "&i&" col 1, This is record "&i&" col 2, This is record "&i&" col 3") Next FileClose(c1) all the best / Björn |
|
|||
|
Dear Gjoisa,
there is actually quite a good example in the helpfile, but here is a something I have used myself: con.New1 cmd.New1("",con.Value) con.Open("Data Source = " & DataF) TableFields="Cat text, Title text, Note text, Deadline text" Txt="create table if not exists MainTable (" & TableFields & ")" cmd.CommandText=Txt cmd.ExecuteNonQuery cmd.CommandText="create table if not exists CatTable (Dummy text, Vis integer, Cat text)" cmd.ExecuteNonQuery It tries to open DataF. If the file does not exist or the database doesn't exist then it creates a database with two tables (MainTable and CatTable), the first with four fields and the second with three fields (the "text" is put in there to give the type of field). The database is opened with filename DataF. But may I suggest that you have a look at the helpfile - it is really quite helpful ![]() all the best / Björn |
|
|||
|
Hi Marc,
but if you write it all together (e.g. "this is col1, this is col2, this is col3") then you will end up with three columns if you open this as a database. If this isn't what you were asking about then I'm afraid I didn't understand the question, could you explain further? all the best / Björn |
|
|||
|
Yes you're right there, but I want to read the file using the SplitString feature on the comma's and it won't look "into" the string if there are any comma's. I want to separate the entries with comma's in one long line actually, just as CSV files.
marc |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| No way to create a recurring appointment? | kolbe | Questions & Help Needed | 2 | 07-02-2008 06:43 PM |
| How to create a new appointment | willisgt | Questions & Help Needed | 2 | 05-15-2008 08:21 PM |
| Command to create a database in sqlite | mozaharul | Questions & Help Needed | 5 | 03-30-2008 03:38 AM |
| Can you help me create B4P lib? | conf | Questions & Help Needed | 7 | 08-20-2007 07:41 PM |
| How to convert an Access database to a sqlite database | Peter | Code Samples & Tips | 5 | 07-24-2007 03:20 PM |