I think I have read almost every post here about SQL Passthrough and cursor adapters and I am still left with questions on the best way to do certain things. I understand that many times the answer will be "it depends" but here are a few questions to help me better understand. First, I use SPT very often to get data to populate controls on a form using something like this (keep in mind the code samples will be just examples):
lnConn = GetConnection() && function to get conection
SQLSelect = "SELECT * FROM OEhdr WHERE salesorder = '" + PADL(ALLTRIM(thisform.txtSono.Value),6,' ') + "'"
RetVal = SQLEXEC(lnConn, SQLSelect, 'OE_data')
IF RECCOUNT() > 0
.... Code to fill controls ....
If I make changes to the data in the OE_data cursor, is there an easy way to send updates back to the SQL server or do I have to do an Update transaction? I currently use SQLEXEC to do an Update of all the fields and set them equal to the values in the controls.
I really like using cursor adapters for data, they handle the updates very well but there are instances where the table has a lot of records. Is there a way to parameterize a CA to limit the returned records?
I know these seem like basic questions and I have been using SPT & CA's for quite some time now but, I think I may be doing things the hard way. I am using VFP9sp2 on WindowsXP.
TIA for any input or guidance.
Ed
lnConn = GetConnection() && function to get conection
SQLSelect = "SELECT * FROM OEhdr WHERE salesorder = '" + PADL(ALLTRIM(thisform.txtSono.Value),6,' ') + "'"
RetVal = SQLEXEC(lnConn, SQLSelect, 'OE_data')
IF RECCOUNT() > 0
.... Code to fill controls ....
If I make changes to the data in the OE_data cursor, is there an easy way to send updates back to the SQL server or do I have to do an Update transaction? I currently use SQLEXEC to do an Update of all the fields and set them equal to the values in the controls.
I really like using cursor adapters for data, they handle the updates very well but there are instances where the table has a lot of records. Is there a way to parameterize a CA to limit the returned records?
I know these seem like basic questions and I have been using SPT & CA's for quite some time now but, I think I may be doing things the hard way. I am using VFP9sp2 on WindowsXP.
TIA for any input or guidance.
Ed