store data returned from a sql query in jscript

E

Elridge

I have the following jscript code in an onClick Event handler for a button in
my infopath form.

//////
var irb_number_text =
XDocument.DOM.selectSingleNode('/dfs:myFields/dfs:dataFields/d:Storage_Table_Preliminary/@IRBNumber').text;

var curr_container_text =
XDocument.DOM.selectSingleNode('/dfs:myFields/dfs:dataFields/d:Storage_Table_Preliminary/@CurrentContainer').text

var match_query = "SELECT COUNT(*) FROM Storage_Table_Preliminary WHERE
IRBNumber = '" + irb_number_text + "' AND CurrentContainer ='" +
curr_container_text +"'";

// make a connection to the database
oConn = new ActiveXObject("ADODB.Connection");
oConn.ConnectionString = XDocument.QueryAdapter.Connection;
oConn.ConnectionTimeout = XDocument.QueryAdapter.Timeout;
oConn.Open();

// execute this query and store the result
var match_count = oConn.Execute(match_query);

XDocument.UI.Alert("Match count: " + match_count);

//// End code

What I am trying to do is get a count of the number of items that match the
criteria in my sql query. However, I don't think I am storing the data (that
is returned from executing my query) in a proper data type: The (Alert)
dialog box does not contain any information in the variable 'match_count'.

-Elridge
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top