Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

error connecting to MS SQL database using Javascript and ASP

Status
Not open for further replies.

kisslogicgoodbye

Programmer
Mar 19, 2001
18
US

I am getting the error: Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.


here is my code (names and passwords changed to protect the innocent):

var SQLConn = Server.CreateObject("ADODB.Connection");
SQLConn.Open("DSN=acme", "sa", "");

var sql_Statement = new String("SELECT ItemNumber, Description, TradeName, SWC, ContractItem_ID FROM ContractItem ORDER BY Contract_ID, ItemNumber, Description");

var fp_getItems = Server.CreateObject("ADODB.Recordset");

var prevItemNumber = new String("");
var prevItemDesc = new String("");
var prevItemTradeName = new String("");
var prevItemSWC = new String("");

var curItemNumber = new String("");
var curItemDesc = new String("");
var curItemTradeName = new String("");
var curItemSWC = new String("");

var i=0;

for (fp_Contracts.MoveFirst(); !fp_Contracts.EOF; fp_Contracts.MoveNext()){
curItemNumber = new String(fp_Contracts("ItemNumber"));
curItemDesc = new String(fp_Contracts("Description"));
curItemTradeName = new String(fp_Contracts("TradeName"));
curItemSWC = new String(fp_Contracts("SWC"));

etc... the script stops when I try to get the recordset.

 
Sorry, ist it me or is it that I can't see where the recordset fp_Contracts is initialised?
 
good point...

you create a recordset that never gets used... and you never Open the recordset. so, you should make changes accordingly:

var fp_getItems = Server.CreateObject("ADODB.Recordset");

should be:

var fp_Contracts = Server.CreateObject("ADODB.Recordset");
fp_Contracts.Open(sql_Statement, SQLConn, 3, 3);

luciddream@subdimension.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top