These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Inserting record in a MS SQL server table

Jesus
Registered: Mar 27 2007
Posts: 54

I have a fillable form that after saved i have the following code to insert a record in a table in MS SQL Server:
 
// Logica para escribir la tabla de indices
xfa.sourceSet.Indices.open();
xfa.sourceSet.Indices.addNew();
 
if (Inicial.rawValue == null)

{Inicial.rawValue = " "}
 
$record.Indices.Nombre.value = Apellidos.rawValue + ", " + Nombre.rawValue + " " + Inicial.rawValue;
$record.Indices.NumdeCuenta.value = NumerodeCuenta.rawValue;
$record.Indices.SeguroSocial.value = SSN.rawValue;
$record.Indices.Licencia.value = Lic.rawValue;
$record.Indices.IdentificacionAlterna.value = String(NumerodeIdentificacionAlterna.rawValue);
$record.Indices.NumdeCelular.value = PhoneNum.rawValue;
$record.Indices.NumdeContrato.value = FormId.rawValue;
$record.Indices.FechadeServicio.value = FechadeServicioPrevio.rawValue;
$record.Indices.IMEI.value = String(IMEI.rawValue);
$record.Indices.SIM.value = String(ICCID.rawValue);
$record.Indices.NombreRepresentante.value = NombredelRep.rawValue;
$record.Indices.Localidad.value = Localidad.editValue;
$record.Indices.Lifeline.value = "No";
if ((String(PlandeVoz.rawValue).substr(1,2)) == 13)
{
$record.Indices.Lifeline.value = "Yes";
}
$record.Indices.TipodeForma.value = "Enmienda";
$record.Indices.Procesado.value = "0";
 
// xfa.host.messageBox("PhoneNum.rawValue " + PhoneNum.rawValue); // temp debug
// xfa.host.messageBox("$record.Indices.Identificacion.value " + $record.Indices.Identificacion.value); // temp debug
// xfa.host.messageBox("$record.Indices.IMEI.value " + $record.Indices.IMEI.value); // temp debug
// xfa.host.messageBox("$record.Indices.SIM.value " + $record.Indices.SIM.value); // temp debug
 
xfa.sourceSet.Indices.update();
xfa.sourceSet.Indices.close();
// hasta aquĆ­
  
The form will be used concurrently by more than 50 users.
 
My question is:
 
1- Is that the correct code to avoid locking of the table?
 
2- Do I have to use the following:
xfa.sourceSet.Indices.nodes.item(1).query.recordSet.lockType = "optimistic";
 
3- Is that the more efficient way to code it?
 
Please give me your comments and advise.
 
Thanks

My Product Information:
LiveCycle Designer, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
What you're asking is really a database question, not an Acrobat/LiveCycle question. Acrobat simply uses the OCX you specify for connecting to the database and performs standard database operations. So the real question is, "How do you set up and connect to MySQL without without locking the table"

You'll have to look at MySQL resources to find this out. Although, since you're opent the DB, adding a new record, and then closing it right away I doubt there will be a problem. But the only way to know is to test it out.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script