PDA

View Full Version : adding record to access db



Mojeaux
05-21-2006, 07:32 PM
Hi Again...

I converted a small vbscript over to javascript to add/append a record to an access db. The script is running client side across a lan.

When I run the script it appears to run fine (I'm not getting errors), but when I check the db.. no record was added. What am I missing here?

<SCRIPT type=text/javascript>

function CheckPassword(){
var polnum;
var appnam;
var relshp;
var rst;
var conn;
var sql;

polnum = document.main.PWD1.value;
appnam = document.main.appnam.value;
relshp = document.main.relshp.value;

rst = new ActiveXObject("ADODB.Recordset");
conn = new ActiveXObject("ADODB.Connection");
conn.open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\\\server\\data\\TESTDB\\testdb.mdb;Persist Security Info=False");

sql = ("INSERT INTO REFERRALS (REFNO, APPNAME, UWRTR) VALUES (polnum, appnam, relshp)");

rst.Open (sql, conn);

alert("It worked");

conn.Close;
rst.Close;
}

</SCRIPT>

One other note... the script only adds 3 fields of a record that normally has about 25. Could this prevent the record from adding/appending?

As always, thank you for your time and help!!
:)