Current location: Hot Scripts Forums » General Web Coding » JavaScript » Recordset problems.. trying to add record to db


Recordset problems.. trying to add record to db

Reply
  #1 (permalink)  
Old 05-22-06, 03:26 PM
AnicoJoe AnicoJoe is offline
New Member
 
Join Date: May 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Angry Recordset problems.. trying to add record to db

I'm running javascript client side over a Lan. I want to run write the results from a form into an Access 97 db.

I am currently getting the following error: "No Value given for one or more required parameters." However, I added an alert message to confirm sql statement and its values were correctly being sent.

I'm now starting to think there is something wrong with my 'rst.open' statement. I'm rather new to this and learning as I go. Can someone plz tell me what I am missing?
Code:
<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\\folder\\TESTDB.mdb");
sql = "INSERT INTO TBL_REFERRALS (REFNO, APPNAME, UWRTR) VALUES (" + polnum + ", " + appnam + ", " + relshp + ")";
alert(sql);

rst.Open (sql, conn, 1, 3);

alert("It worked!!");

rst.Close;
conn.Close;
}

</SCRIPT>

Last edited by TwoD; 05-23-06 at 07:01 AM. Reason: Please use [code][/code] wrappers.
Reply With Quote
  #2 (permalink)  
Old 05-22-06, 08:04 PM
jfulton's Avatar
jfulton jfulton is offline
Community VIP
 
Join Date: Apr 2006
Location: Los Angeles, CA
Posts: 660
Thanks: 0
Thanked 0 Times in 0 Posts
I've never really worked with ActiveXObjects via Javascript before, but that error makes it sound like it is either a malformed sql statement, or there is a required field in your database table that is not getting a value. Make sure that everything is in the proper format (strings are quoted, etc. - at least I think they have to be in Access, right?) and that you are not missing any required fields from your query.
Reply With Quote
  #3 (permalink)  
Old 05-23-06, 07:05 AM
TwoD TwoD is offline
Community VIP
 
Join Date: Sep 2003
Location: 404
Posts: 1,813
Thanks: 0
Thanked 0 Times in 0 Posts
I've not seen this error before with that object...
Check out the MSDN Library, maybe it will have the answer..
Threre might be somehting about this near "Win32 and COM Development > Data Access and Storage > Microsoft ActiveX Data Objects (ADO) > ADO Programmer's Reference > ADO API Reference > ADO Objects and Interfaces"
Or try searching for "ADODB.Recordset"
__________________
[W3Schools - learn all about the standards.] [QuirksMode - Browser Quirks] [MS's Online Reference Docs] [DOM in Gecko.]
Please pay attention to stickys, announcements and forum rules, thank you.
Please also remember Code Wrappers and [SOLVED] Marking, this helps everyone.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP | db recordset paging PLEASE HELP!! burns ASP 3 02-27-06 12:23 PM
HOw to add, update, edit, delete record in 2 tables? andrew123 ASP 4 01-24-06 04:28 PM
Alter Table Help DDRcasey PHP 0 06-14-05 12:08 AM
One of the most common problems mICHAELD ASP 1 03-08-05 09:59 AM


All times are GMT -5. The time now is 11:10 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.