Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

problem with realsqldatabase - inserting data (Real Studio network user group Mailinglist archive)

Back to the thread list
Previous thread: QuickTime 7 Windows Crash
Next thread: RB Syntax


Win32 API Declares   -   Berg, Heath
  problem with realsqldatabase - inserting data   -   info os-plus.de
   Re: problem with realsqldatabase - inserting data   -   Me
   Re: problem with realsqldatabase - inserting data   -   Loren
    Re: problem with realsqldatabase - inserting data   -   info os-plus.de
   Re: problem with realsqldatabase - inserting data   -   Norman Palardy
    Re: problem with realsqldatabase - inserting data   -   info os-plus.de
   Re: problem with realsqldatabase - inserting data   -   Brian Kessel
   Re: problem with realsqldatabase - inserting data   -   Marco Bambini
   Re: problem with realsqldatabase - inserting data   -   Norman Palardy
   Re: problem with realsqldatabase - inserting data   -   info os-plus.de

problem with realsqldatabase - inserting data
Date: 01.08.05 23:45 (Mon, 1 Aug 2005 22:45:31 +0000)
From: info os-plus.de
hi,

i do some tests with realsqldatabase. i could create a db by code without problems. when i use the following code creating data i receive no error message. when i look with sqllite manager into the db i do not see my test data. it makes no difference if the dbfile is on a networkdrive or a localdrive.

Dim dbFile as FolderItem
Dim db as REALSQLdatabase
db=New REALSQLdatabase

dbFile=GetFolderItem("TriFact2.rsd")
db.databaseFileÛFile

if db.connect then
db.sqlexecute ("Insert into CompTab (CompNumber,CompName,CompStreet,CompPlz,CompCity,CompFax,CompPhone,CompWeb,CompTaxId,CompDeleted)"_
+"Values ('testnumber1','testname1','teststreet1','testplz1','testcity1','testfax1','testphone1','testweb1','testtaxid1','testdeleted1')")
if db.error then
msgbox db.ErrorMessage
else
db.Commit
msgbox "data created"
end if
end if

are there any usefull documentation about working with realsqldatabase in rb2005? the languagereference (pdf) seems not to be finish or 100% correct.

chris
-

Re: problem with realsqldatabase - inserting data
Date: 01.08.05 23:18 (Mon, 1 Aug 2005 17:18:08 -0500)
From: Me
You can use the DatabaseRecord Class to add records.


Sometimes, if you make an error in the statement, it will fail without
reporting an error.

The SQLite error checker doesn't spot any problems, but the statement fails.


It you are adding a lot of records, it's best to wrap it with 'BEGIN
TRANSACTION', 'END TRANSACTION' statements.


I don't see what's wrong with your statement, something is.

I have over 50 tables, it works great.

They did an excellent job on the SQLite wrapper.

You have to play around with it a little bit to get the hang of it.


> i do some tests with realsqldatabase. i could create a db by code without
> problems. when i use the following code creating data i receive no error
> message. when i look with sqllite manager into the db i do not see my test
> data. it makes no difference if the dbfile is on a networkdrive or a
> localdrive.
>
> Dim dbFile as FolderItem
> Dim db as REALSQLdatabase
> db=New REALSQLdatabase
>
> dbFile=GetFolderItem("TriFact2.rsd")
> db.databaseFileÛFile
>
> if db.connect then
> db.sqlexecute ("Insert into CompTab
> (CompNumber,CompName,CompStreet,CompPlz,CompCity,CompFax,CompPhone,CompWeb,CompTaxId,CompDeleted)"_
> +"Values
> ('testnumber1','testname1','teststreet1','testplz1','testcity1','testfax1','testphone1','testweb1','testtaxid1','testdeleted1')")
> if db.error then
> msgbox db.ErrorMessage
> else
> db.Commit
> msgbox "data created"
> end if
> end if
>
\

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: problem with realsqldatabase - inserting data
Date: 02.08.05 05:54 (Mon, 1 Aug 2005 21:54:46 -0700)
From: Loren

On Aug 1, 2005, at 3:45 PM, <email address removed> wrote:

> hi,
>
> i do some tests with realsqldatabase. i could create a db by code
> without problems. when i use the following code creating data i
> receive no error message. when i look with sqllite manager into the
> db i do not see my test data. it makes no difference if the dbfile
> is on a networkdrive or a localdrive.
>
> Dim dbFile as FolderItem
> Dim db as REALSQLdatabase
> db=New REALSQLdatabase
>
> dbFile=GetFolderItem("TriFact2.rsd")
> db.databaseFileÛFile
>
> if db.connect then
> db.sqlexecute ("Insert into CompTab
> (CompNumber,CompName,CompStreet,CompPlz,CompCity,CompFax,CompPhone,Com
> pWeb,CompTaxId,CompDeleted)"_
> +"Values
> ('testnumber1','testname1','teststreet1','testplz1','testcity1','testf
> ax1','testphone1','testweb1','testtaxid1','testdeleted1')")
> if db.error then
> msgbox db.ErrorMessage
> else
> db.Commit
> msgbox "data created"
> end if
> end if
>
> are there any usefull documentation about working with
> realsqldatabase in rb2005? the languagereference (pdf) seems not to
> be finish or 100% correct.
>

not sure but maybe a 'space' between the

)"_
+"Values

i haven't used realsqldatabase yet, but you string is

> ,CompDeleted)Values ('testnumber1',

in that center part

_/ | \________________________________
Loren - discodj aut mac daut com
RB Mac 2005P r1 and 555P and Win 555P Ide
Einhugarfied and monkey'd up
Tigger 10.4.2 - g5 2Gz 2gig ram
W2000 on Virt Pc and some 486 laptop



_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: problem with realsqldatabase - inserting data
Date: 02.08.05 21:41 (Tue, 2 Aug 2005 20:41:01 +0000)
From: info os-plus.de
On Mon, Aug 01, 2005 at 09:54:46PM -0700, Loren wrote:
>
> On Aug 1, 2005, at 3:45 PM, <email address removed> wrote:
>
> >hi,
> >
> >i do some tests with realsqldatabase. i could create a db by code
> >without problems. when i use the following code creating data i
> >receive no error message. when i look with sqllite manager into the
> >db i do not see my test data. it makes no difference if the dbfile
> >is on a networkdrive or a localdrive.
> >
> > Dim dbFile as FolderItem
> > Dim db as REALSQLdatabase
> > db=New REALSQLdatabase
> >
> > dbFile=GetFolderItem("TriFact2.rsd")
> > db.databaseFileÛFile
> >
> > if db.connect then
> > db.sqlexecute ("Insert into CompTab
> >(CompNumber,CompName,CompStreet,CompPlz,CompCity,CompFax,CompPhone,Com
> >pWeb,CompTaxId,CompDeleted)"_
> > +"Values
> >('testnumber1','testname1','teststreet1','testplz1','testcity1','testf
> >ax1','testphone1','testweb1','testtaxid1','testdeleted1')")
> > if db.error then
> > msgbox db.ErrorMessage
> > else
> > db.Commit
> > msgbox "data created"
> > end if
> > end if
> >
> >are there any usefull documentation about working with
> >realsqldatabase in rb2005? the languagereference (pdf) seems not to
> >be finish or 100% correct.
> >
> not sure but maybe a 'space' between the
>
> )"_
> +"Values
>
> i haven't used realsqldatabase yet, but you string is
>
> >,CompDeleted)Values ('testnumber1',
>
> in that center part
>
> _/ | \________________________________
> Loren - discodj aut mac daut com
> RB Mac 2005P r1 and 555P and Win 555P Ide
> Einhugarfied and monkey'd up
> Tigger 10.4.2 - g5 2Gz 2gig ram
> W2000 on Virt Pc and some 486 laptop
>

the missing space is no problem. i tested it with and without space.

-

Re: problem with realsqldatabase - inserting data
Date: 02.08.05 06:26 (Mon, 1 Aug 2005 23:26:08 -0600)
From: Norman Palardy

On Aug 01, 2005, at 4:18 PM, Me wrote:
>> i do some tests with realsqldatabase. i could create a db by code
>> without problems. when i use the following code creating data i
>> receive no error message. when i look with sqllite manager into the
>> db i do not see my test data. it makes no difference if the dbfile is
>> on a networkdrive or a localdrive.
>>
>> Dim dbFile as FolderItem
>> Dim db as REALSQLdatabase
>> db=New REALSQLdatabase
>>
>> dbFile=GetFolderItem("TriFact2.rsd")
>> db.databaseFileÛFile
>>
>> if db.connect then
>> db.sqlexecute ("Insert into CompTab
>> (CompNumber,CompName,CompStreet,CompPlz,CompCity,CompFax,CompPhone,Com
>> pWeb,CompTaxId,CompDeleted)"_
>> +"Values
>> ('testnumber1','testname1','teststreet1','testplz1','testcity1','testf
>> ax1','testphone1','testweb1','testtaxid1','testdeleted1')")
>> if db.error then
>> msgbox db.ErrorMessage
>> else
>> db.Commit
>> msgbox "data created"
>> end if
>> end if
>>

Very interesting.
There seems to be a bug in the browser built in to the IDE

If you do

Dim dbFile as FolderItem
Dim db as REALSQLdatabase
db=New REALSQLdatabase

dbFile=GetFolderItem("TriFact2.rsd")

db.databaseFileÛFile

if db.CreateDatabaseFile then
db.sqlexecute ("create table CompTab (CompNumber text)" )

db.sqlexecute ("Insert into CompTab (CompNumber) Values
('testnumber1')")

if db.error then
msgbox db.ErrorMessage
else
db.Commit
msgbox "data created"
end if
end if

you get the message saying the data is created

Then Go to Project > Add > Database and select the database just
created.
When you use the IDE browser no data shows.
However, if you query the table and use a query like "CompNumber is not
NULL" the data shows.

At least it did for me.

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: problem with realsqldatabase - inserting data
Date: 02.08.05 21:43 (Tue, 2 Aug 2005 20:43:20 +0000)
From: info os-plus.de
On Mon, Aug 01, 2005 at 11:26:08PM -0600, Norman Palardy wrote:
>
> On Aug 01, 2005, at 4:18 PM, Me wrote:
> >>i do some tests with realsqldatabase. i could create a db by code
> >>without problems. when i use the following code creating data i
> >>receive no error message. when i look with sqllite manager into the
> >>db i do not see my test data. it makes no difference if the dbfile is
> >>on a networkdrive or a localdrive.
> >>
> >> Dim dbFile as FolderItem
> >> Dim db as REALSQLdatabase
> >> db=New REALSQLdatabase
> >>
> >> dbFile=GetFolderItem("TriFact2.rsd")
> >> db.databaseFileÛFile
> >>
> >> if db.connect then
> >> db.sqlexecute ("Insert into CompTab
> >>(CompNumber,CompName,CompStreet,CompPlz,CompCity,CompFax,CompPhone,Com
> >>pWeb,CompTaxId,CompDeleted)"_
> >> +"Values
> >>('testnumber1','testname1','teststreet1','testplz1','testcity1','testf
> >>ax1','testphone1','testweb1','testtaxid1','testdeleted1')")
> >> if db.error then
> >> msgbox db.ErrorMessage
> >> else
> >> db.Commit
> >> msgbox "data created"
> >> end if
> >> end if
> >>
> Very interesting.
> There seems to be a bug in the browser built in to the IDE
>
> If you do
>
> Dim dbFile as FolderItem
> Dim db as REALSQLdatabase
> db=New REALSQLdatabase
>
> dbFile=GetFolderItem("TriFact2.rsd")
>
> db.databaseFileÛFile
>
> if db.CreateDatabaseFile then
> db.sqlexecute ("create table CompTab (CompNumber text)" )
>
> db.sqlexecute ("Insert into CompTab (CompNumber) Values
> ('testnumber1')")
>
> if db.error then
> msgbox db.ErrorMessage
> else
> db.Commit
> msgbox "data created"
> end if
> end if
>
> you get the message saying the data is created
>
> Then Go to Project > Add > Database and select the database just
> created.
> When you use the IDE browser no data shows.
> However, if you query the table and use a query like "CompNumber is not
> NULL" the data shows.
>
> At least it did for me.

yes, in the ide are not all things implemented what you would need for db development. you have to do this by own code or other tools like sqllitemanager.
--

Re: problem with realsqldatabase - inserting data
Date: 02.08.05 20:02 (Tue, 2 Aug 2005 14:02:06 -0500)
From: Brian Kessel
I suggest using the quote (`) above the tab key around your field
names...

Also, I have not had good luck breaking that line. Start small, get
it working then add your data.
Brian

On Aug 2, 2005, at 3:41 PM, <email address removed> wrote:

> On Mon, Aug 01, 2005 at 09:54:46PM -0700, Loren wrote:
>
>>
>> On Aug 1, 2005, at 3:45 PM, <email address removed> wrote:
>>
>>> hi,
>>>
>>> i do some tests with realsqldatabase. i could create a db by code
>>> without problems. when i use the following code creating data i
>>> receive no error message. when i look with sqllite manager into the
>>> db i do not see my test data. it makes no difference if the dbfile
>>> is on a networkdrive or a localdrive.
>>>
>>> Dim dbFile as FolderItem
>>> Dim db as REALSQLdatabase
>>> db=New REALSQLdatabase
>>>
>>> dbFile=GetFolderItem("TriFact2.rsd")
>>> db.databaseFileÛFile
>>>
>>> if db.connect then
>>> db.sqlexecute ("Insert into CompTab
>>> (CompNumber,CompName,CompStreet,CompPlz,CompCity,CompFax,CompPhone,C
>>> om
>>> pWeb,CompTaxId,CompDeleted)"_
>>> +"Values
>>> ('testnumber1','testname1','teststreet1','testplz1','testcity1','tes
>>> tf
>>> ax1','testphone1','testweb1','testtaxid1','testdeleted1')")
>>> if db.error then
>>> msgbox db.ErrorMessage
>>> else
>>> db.Commit
>>> msgbox "data created"
>>> end if
>>> end if
>>>
>>> are there any usefull documentation about working with
>>> realsqldatabase in rb2005? the languagereference (pdf) seems not to
>>> be finish or 100% correct.
>>>
>>>
>> not sure but maybe a 'space' between the
>>
>> )"_
>> +"Values
>>
>> i haven't used realsqldatabase yet, but you string is
>>
>>> ,CompDeleted)Values ('testnumber1',
>>>
>> in that center part
>>
>> _/ | \________________________________
>> Loren - discodj aut mac daut com
>> RB Mac 2005P r1 and 555P and Win 555P Ide
>> Einhugarfied and monkey'd up
>> Tigger 10.4.2 - g5 2Gz 2gig ram
>> W2000 on Virt Pc and some 486 laptop
>>
> the missing space is no problem. i tested it with and without space.
>
> --
> Christian Jeannot eMail:
> <email address removed>
> DV-Kaufmann Telefon:
> +49 821 4504548
> Telefax:
> +49 821 4504549
> Open Source Mobil:
> +49 179 6946446
> IT-Security Postal: Vogelmauer 17
> Netzwerkkonzepte 86152 Augsburg
> _______________________________________________
> Unsubscribe or switch delivery mode:
> <http://www.realsoftware.com/support/listmanager/>
> Search the archives of this list here:
> <http://support.realsoftware.com/listarchives/lists.html>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: problem with realsqldatabase - inserting data
Date: 02.08.05 20:11 (Tue, 2 Aug 2005 21:11:54 +0200)
From: Marco Bambini
What about something like:

Dim dbFile as FolderItem
Dim db as REALSQLdatabase
Dim rec as DatabaseRecord

db=New REALSQLdatabase

dbFile=GetFolderItem("TriFact2.rsd")
db.databaseFileÛFile

if db.connect then
rec = New DatabaseRecord
rec.Column("CompNumber")="testnumber1"
rec.Column("CompName")="testname1"
rec.Column("CompStreet")="teststreet1"
...
db.InsertRecord("CompTab", rec)
db.Commit
endif

It isn't much more easier to read and maintain?

Marco Bambini
SQLabs.net

On Aug 2, 2005, at 9:02 PM, Brian Kessel wrote:

> I suggest using the quote (`) above the tab key around your field
> names...
>
> Also, I have not had good luck breaking that line. Start small, get
> it working then add your data.
> Brian
>
> On Aug 2, 2005, at 3:41 PM, <email address removed> wrote:
>
>> On Mon, Aug 01, 2005 at 09:54:46PM -0700, Loren wrote:
>>
>>>
>>> On Aug 1, 2005, at 3:45 PM, <email address removed> wrote:
>>>
>>>
>>>
>>>> hi,
>>>>
>>>> i do some tests with realsqldatabase. i could create a db by code
>>>> without problems. when i use the following code creating data i
>>>> receive no error message. when i look with sqllite manager into the
>>>> db i do not see my test data. it makes no difference if the dbfile
>>>> is on a networkdrive or a localdrive.
>>>>
>>>> Dim dbFile as FolderItem
>>>> Dim db as REALSQLdatabase
>>>> db=New REALSQLdatabase
>>>>
>>>> dbFile=GetFolderItem("TriFact2.rsd")
>>>> db.databaseFileÛFile
>>>>
>>>> if db.connect then
>>>> db.sqlexecute ("Insert into CompTab
>>>> (CompNumber,CompName,CompStreet,CompPlz,CompCity,CompFax,CompPhone,
>>>> Com
>>>> pWeb,CompTaxId,CompDeleted)"_
>>>> +"Values
>>>> ('testnumber1','testname1','teststreet1','testplz1','testcity1','te
>>>> stf
>>>> ax1','testphone1','testweb1','testtaxid1','testdeleted1')")
>>>> if db.error then
>>>> msgbox db.ErrorMessage
>>>> else
>>>> db.Commit
>>>> msgbox "data created"
>>>> end if
>>>> end if
>>>>
>>>> are there any usefull documentation about working with
>>>> realsqldatabase in rb2005? the languagereference (pdf) seems not to
>>>> be finish or 100% correct.
>>>>
>>>>
>>>>
>>>
>>> not sure but maybe a 'space' between the
>>>
>>> )"_
>>> +"Values
>>>
>>> i haven't used realsqldatabase yet, but you string is
>>>
>>>
>>>
>>>> ,CompDeleted)Values ('testnumber1',
>>>>
>>>>
>>>
>>> in that center part
>>>
>> ...
>> the missing space is no problem. i tested it with and without space.

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: problem with realsqldatabase - inserting data
Date: 02.08.05 20:15 (Tue, 2 Aug 2005 13:15:43 -0600)
From: Norman Palardy

On Aug 02, 2005, at 2:43 PM, <email address removed> wrote:
>
> yes, in the ide are not all things implemented what you would need for
> db development. you have to do this by own code or other tools like
> sqllitemanager.
>
Agreed it would be good if it worked in the IDE and is the reason I
submitted a bug report.

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: problem with realsqldatabase - inserting data
Date: 02.08.05 21:47 (Tue, 2 Aug 2005 20:47:28 +0000)
From: info os-plus.de
On Mon, Aug 01, 2005 at 10:45:31PM +0000, <email address removed> wrote:
> hi,
>
> i do some tests with realsqldatabase. i could create a db by code without problems. when i use the following code creating data i receive no error message. when i look with sqllite manager into the db i do not see my test data. it makes no difference if the dbfile is on a networkdrive or a localdrive.
>
> Dim dbFile as FolderItem
> Dim db as REALSQLdatabase
> db=New REALSQLdatabase
>
> dbFile=GetFolderItem("TriFact2.rsd")
> db.databaseFileÛFile
>
> if db.connect then
> db.sqlexecute ("Insert into CompTab (CompNumber,CompName,CompStreet,CompPlz,CompCity,CompFax,CompPhone,CompWeb,CompTaxId,CompDeleted)"_
> +"Values ('testnumber1','testname1','teststreet1','testplz1','testcity1','testfax1','testphone1','testweb1','testtaxid1','testdeleted1')")
> if db.error then
> msgbox db.ErrorMessage
> else
> db.Commit
> msgbox "data created"
> end if
> end if
>
> are there any usefull documentation about working with realsqldatabase in rb2005? the languagereference (pdf) seems not to be finish or 100% correct.
>
> chris
> --
> Christian Jeannot eMail: <email address removed>

i checked my different version of code and find a mistake made by myself. when i tested the db on network drive and on localdrive i selected the wrong db in sqllitemanager. the following code so works, the code commented with // works not.

Dim dbFile as FolderItem
Dim db as REALSQLdatabase
dim rs as new recordset
db=New REALSQLdatabase

dbFile=GetFolderItem("TriFact2.rsd")
db.databaseFileÛFile

if db.connect then
db.sqlexecute ("Insert into CompTab (CompNumber,CompName,CompStreet,CompPlz,CompCity,CompFax,CompPhone,CompWeb,CompTaxId,CompDeleted)"_
+"Values ('testnumber1','testname1','teststreet1','testplz1','testcity1','testfax1','testphone1','testweb1','testtaxid1','testdeleted1')")
if db.error then
msgbox db.ErrorMessage
else
db.SQLExecute("Commit")
msgbox "data created"
end if
end if

//Dim dbFile as FolderItem
//Dim db as REALSQLdatabase
//db=New REALSQLdatabase
//dbFile=GetFolderItem("TriFact2.rsd")
//db.databaseFileÛFile
//if db.error then
//MsgBox db.errormessage
//else
//db.sqlexecute ("Insert into CompTab (CompNumber,CompName,CompStreet,CompPlz,CompCity,CompFax,CompPhone,CompWeb,CompTaxId,CompDeleted)"_
//+"Values ('testnumber1','testname1','teststreet1','testplz1','testcity1','testfax1','testphone1','testweb1','testtaxid1','testdeleted1')")
//MsgBox "Datensatz eingetragen"
//If db.error then
//MsgBox db.errormessage
//else
//db.Commit
//end if
//db.close
//end if
--