Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Tue Oct 15, 2019 10:16 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Problem assigning Cell Values with Strings from DB
PostPosted: Wed Feb 16, 2011 11:36 am 
Offline

Joined: Wed Feb 16, 2011 11:27 am
Posts: 9
Hey guys!

So, RB WE is pretty nice, and I've been building some applications with my trial edition here before we make a purchase.
Guh, there's plenty of bugs though! And almost 0 documentation. This is some beta stuff :<
Either way, I've got a pretty nasty bug, or what I THINK is a bug. I've been fooling around with it for a day, and have exhausted every method I know of, but I've narrowed it down to this:
If there exists data in a table, and you try to clear it, then add rows and assign values to their cells, this is fine and dandy. But when you try to assign values from a MySQL database, the whole procedure seems to fail, with no error message. It just doesn't execute. Even if I assign these values to a string variable, then assign them to a cell, it still fails. But if I just assign these cell values any old string that didn't come from a database, it works fine. In addition, if I print the DB string values to a Label somewhere on the page, it works fine as well. But the moment I assign Cell = String from database, it fails.

Note that when the Page opens, it executes the same code just fine. This only happens either because a) there existed data in the table, or b) it's a user-initiated action (they clicked on a button). I, of course, am not sure!

Here's the rather simple code I'm executing:

dim myquery as string
dim rs as recordSet
dim ycell as Integer

Session.CompanyIndexNo = Session.CompanyIndexNo + 100

myquery = "SELECT ID_Companies, Customer_Name, Customer_Status, City, State, Phone_Number, Sales_History, Industry FROM Companies ORDER BY Time_Created DESC LIMIT "+str(Session.CompanyIndexNo - 100)+", "+str(Session.CompanyIndexNo)+""

rs = Session.softsincPowertrax.SQLSelect(myquery)

Do Until rs <> nil
msgbox "There was an error in MySQL: "+ Session.softsincPowertrax.ErrorMessage
Session.softsincPowertrax.close
Session.IsConnected = Session.softsincPowertrax.connect
rs = Session.softsincPowertrax.SQLSelect(myquery)
Loop

Table.deleteAllRows

do until rs.EOF

Table.addrow ""

ycell=Table.RowCount -1

Table.cell(ycell,0) = rs.field("Customer_Name").stringValue
Table.cell(ycell,1) = rs.field("Customer_Status").stringValue
Table.cell(ycell,2) = rs.field("City").stringValue
Table.cell(ycell,3) = rs.field("State").stringValue
Table.cell(ycell,4) = rs.field("Phone_Number").stringValue
Table.cell(ycell,5) = rs.field("Sales_History").stringValue
Table.cell(ycell,6) = rs.field("Industry").stringValue
Table.cell(ycell,7) = rs.field("ID_Companies").stringValue

rs.movenext

loop

rs.close


If I change that last bit to, say:

do until rs.EOF

Table.addrow ""

ycell=Table.RowCount -1

Table.cell(ycell,0) = "test1"
Table.cell(ycell,1) = "test1"
Table.cell(ycell,2) = "test1"
Table.cell(ycell,3) = "test1"
Table.cell(ycell,4) = "test1"
Table.cell(ycell,5) = "test1"
Table.cell(ycell,6) = "test1"
Table.cell(ycell,7) = "test1"

SomeGlobalVar = rs.field("Customer_Name").stringValue
SomeGlobalVar = rs.field("Customer_Status").stringValue
SomeGlobalVar = rs.field("City").stringValue
SomeGlobalVar = rs.field("State").stringValue
SomeGlobalVar = rs.field("Phone_Number").stringValue
SomeGlobalVar = rs.field("Sales_History").stringValue
SomeGlobalVar = rs.field("Industry").stringValue
SomeGlobalVar = rs.field("ID_Companies").stringValue

rs.movenext

loop


This will WORK. It will populate the table with bogus data, and assign all the DB strings to SomeGlobalVar (albeit overwriting each other each time, but who cares- it proves those DB values are working just fine.)

Any help is appreciated! D: I'm baffled


Top
 Profile  
Reply with quote  
 Post subject: Re: Problem assigning Cell Values with Strings from DB
PostPosted: Wed Feb 16, 2011 11:51 am 
Offline

Joined: Wed Feb 16, 2011 11:27 am
Posts: 9
Nevermind, I'm ridiculous >_> I structured my Query wrong. It should be something like LIMIT CompanyIndexNo, 100

d'oh. Still, it doesn't seem to support writing those 100 records. I had to bring it down to 50 before it started working again..!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 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