Creating desktop or client-server database solutions?
Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller
- Posts: 57
- Joined: Tue Nov 18, 2014 5:36 pm
I have this bit of code:
Code: Select all
put "SELECT * FROM customers WHERE company = '"&company& "'" into dbSQL
put revDataFromQuery(tab,return,connectionID,dbSQL) into dbData
if item 1 of dbData = "revdberr" then
answer error "There was a problem" & cr & dbData
This, I believe, is the code for when populating a data grid. However, I was wondering if there was a way to get the query data put into an array so I can display each piece of data seperatly without using a datagrid.
I would like to populate text fields with the data from the query. In this instance, what I'm after is something along the lines of dbData[collum1] dbData[collum2]. The queries that will be run only return 1 row from the database.
- Posts: 746
- Joined: Sun Feb 04, 2007 11:01 pm
- Location: McKenna, WA
Here's something to get you started. I see that you have a variable named company and a column named company. I suggest you follow the variable naming convention and put a t in front of a temp variable. The code below also eliminates the need for the single/double quotes syntax.
Code: Select all
put fld "theCompany" into tCompany
put "SELECT colunm1, column2, coulun3 FROM customers WHERE company =:1" into tSQLStatement
put revDataFromQuery(tab,cr, the uDatabaseID of this stack ,tSQLStatement,"tCompany") into theData
set the itemDel to tab
put item 1 of theData into fld "thisField" -- col1
put item 2 of theData into fld "thatField" -- col2
put item 3 of theData into fld "anotherField" -- col3
set the itemDel to comma
MacBook Pro OS Mojave 10.14