realbasic-nug
[Top] [All Lists]

Re: Importing Records in MySQL

To: REALbasic Network Users Group <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Importing Records in MySQL
From: "Fco. Javier Romojaro Pascual" <javier dot romojaro at bancoval dot es>
Date: Thu, 31 Oct 2002 09:41:09 +0100
Hi Youri:

This is correct and it has to run, but have you:

r as databaserecord
and

is a tab file you want open??

Youri wrote:

> Hi Folks,
>
> Lots of pb to start this sunny day ;-)
>
> 1/ The following code crashes RB every time (after connecting to my MySQL
> database) :
>
>   f=GetOpenFolderItem("????")
>
>   if f<>Nil then
>     textinput = f.OpenAsTextFile
>     Do
>       r = New DatabaseRecord
>       rowFromFile=textInput.ReadLine
>       r.Column("nomste")=nthField(rowFromFile,Chr(9),1)
>       db.InsertRecord("companies",r)
>     Loop Until textinput.eof
>     textinput.Close
>   End if
> db.close
>
> The line holding :
> r.Column("nomste")=nthField(rowFromFile,Chr(9),1)
>
> Seems to be causing problem, but what?
>
> My DB holds 1 table "companies" and 2 fields "nomste", "idste" (primary key,
> auto_increment)
>
> the "Tab" file I try to import is like :
>
> TOTO    1
> TITI    2
> TATA    3
> ....
>
> 2/ I tried to take " r = New DatabaseRecord" out of the Do...Loop, but it
> doesn't work either. Is this the rigth place to put it?
>
> 3/ When connecting to a DB such as MySQL, do I have to open a new connection
> in every Method or Event Handler and then close it every time, or can I open
> a connection at the opening and close it when quitting?
>
> 4/ When importing datas such as my tab file, do I have to import the
> "idste", knowing that it is a auto_increment value?
>
> TIA
>
> Youri
>
> ---
> A searchable archive of this list is available at:
> <http://dbserver.realsoftware.com/KBDB/search.php>
>
> Unsubscribe:
> <mailto:realbasic-nug-off at lists dot realsoftware dot com>
>
> Subscribe to the digest:
> <mailto:realbasic-nug-digest at lists dot realsoftware dot com>


---
A searchable archive of this list is available at:
<http://dbserver.realsoftware.com/KBDB/search.php>

Unsubscribe:
<mailto:realbasic-nug-off at lists dot realsoftware dot com>

Subscribe to the digest: 
<mailto:realbasic-nug-digest at lists dot realsoftware dot com>
.


<Prev in Thread] Current Thread [Next in Thread>