Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Sun Sep 15, 2019 6:59 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: db.SQLSelect
PostPosted: Wed Jan 30, 2013 1:11 pm 
Offline

Joined: Sat Jan 26, 2013 7:02 pm
Posts: 14
I try to include information from the selection in the variable trans, but I fail in the MsgBox.

Dim db as New REALSQLdatabase
Dim result As Boolean
Dim rs As RecordSet
Dim dbFile as FolderItem
Dim trans As String

db=New REALSQLdatabase
dbFile=Getfolderitem("/Library/Server/Web/Data/Sites/123univers/curseur.rsd",FolderItem.PathTypeShell)//Real SQL DB
db.DatabaseFile=dbFile
//result = db.CreateDatabaseFile
If db.error then
MsgBox db.errormessage
else
rs=db.SQLSelect("SELECT * FROM client WHERE motpasse="+PageIndex.Log1.pass.Text)
end if

If rs <> Nil then
trans = rs.IdxField(1).StringValue//rs.Field("id")
rs.Close
else
MsgBox "Pas de données"
end if

if trans = id.text then
App.id=id.text
App.pass=pass.text
PageIndex.Log1.Close
else
MsgBox "Vous n'êtes pas inscrit ou vous avez entré les mauvaises informations."
end if

db.Close


Y'a t'il quelque chose à faire?


Alain

_________________
MacMiniServer 10.8.2


Top
 Profile  
Reply with quote  
 Post subject: Re: db.SQLSelect
PostPosted: Wed Jan 30, 2013 2:11 pm 
Offline
User avatar

Joined: Fri Sep 30, 2005 11:48 am
Posts: 3554
Location: Lenexa, KS
You need to check for a database error after EVERY transaction.


rs=db.SQLSelect("SELECT * FROM client WHERE motpasse="+PageIndex.Log1.pass.Text)
If db.error then
MsgBox db.errormessage
return
end

_________________
Bob K.

A blog about being a Real Studio/Xojo developer at http://www.bkeeneybriefs.com


Top
 Profile  
Reply with quote  
 Post subject: Re: db.SQLSelect
PostPosted: Wed Jan 30, 2013 2:58 pm 
Offline
User avatar

Joined: Fri Jun 05, 2009 11:50 am
Posts: 348
Location: Hamburg, Germany
rs=db.SQLSelect("SELECT * FROM client WHERE motpasse="+PageIndex.Log1.pass.Text)


You need to put strings in single quotes

I bet this will work

rs=db.SQLSelect("SELECT * FROM client WHERE motpasse = '"+PageIndex.Log1.pass.Text+"'")


In SQL Strings need to be put in single quotes

in case PageIndex.Log1.pass.Text = ThisIsTheContent

the above sql will be

Quote:
SELECT * FROM client WHERE motpasse = 'ThisIsTheContent'


MAy I suggest to look for an SQL Tutorial

_________________
Best regards

Stefan

Mac OSX Mountain Lion (latest Release) on a MacBook Pro 2.66 GHz Intel Core i7/ RB Professional 2011 Release 3


Top
 Profile  
Reply with quote  
 Post subject: Re: db.SQLSelect
PostPosted: Wed Jan 30, 2013 3:18 pm 
Offline

Joined: Sat Jan 26, 2013 7:02 pm
Posts: 14
Thank you, that's it.

Alain

_________________
MacMiniServer 10.8.2


Top
 Profile  
Reply with quote  
 Post subject: Re: db.SQLSelect
PostPosted: Wed Jan 30, 2013 4:43 pm 
Offline
User avatar

Joined: Fri Jun 05, 2009 11:50 am
Posts: 348
Location: Hamburg, Germany
May i point your attention to this thread regarding escaping single quotes

And not to forget the first sticky thread in the database forum

_________________
Best regards

Stefan

Mac OSX Mountain Lion (latest Release) on a MacBook Pro 2.66 GHz Intel Core i7/ RB Professional 2011 Release 3


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group