// Globals var dbName = "AcroTips"; var dbConn = null; var stmtObj = null; var sqlToExecute = "Select * from Customers"; var rowObj = null; function Connect() { try { dbConn = ADBC.newConnection(dbName); if(dbConn == null) throw "Error connecting to AcroTips"; stmtObj = dbConn.newStatement(); // Execute the SQL statement inside the database stmtObj.execute(sqlToExecute); // Move the Result Set to the First Record Found stmtObj.nextRow(); // The current row object rowObj = stmtObj.getRow(); // Insert the values of the first Row of data into the // form field values. FillForm(rowObj); // Let the user know that a connection was made. app.alert("Connected to AcroTips"); } catch(exc) { console.println(exc); throw "Unable to Connect to Database"; } } function nextRecord() { try { stmtObj.nextRow(); FillForm(stmtObj.getRow()); } catch(e) { } } function firstRecord() { stmtObj.execute(sqlToExecute); stmtObj.nextRow(); rowObj = stmtObj.getRow(); FillForm(rowObj); } function FillForm(row) { this.getField("FirstName").value = row.FirstName.value; this.getField("LastName").value = row.LastName.value; this.getField("Address").value = row.Address.value; this.getField("SSNumber").value = row.SSN.value; this.getField("Comments").value = row.Comments.value; }