Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] While statement array losing data
- From: twlewis at softhome.net (Tim Lewis)
- Subject: [Javascript] While statement array losing data
- Date: Thu May 17 07:47:49 2007
This list is great! I come from a VB background, and learning JS. I have
a routine in which I load data through DAO into an array. My problem is
that as soon as the program leaves my While statement, the data in the
array disappears. I have studied and studied my code, but I cannot find a
reason. I am very thankful for any help on this.
Tim
My code is:
<html><head>
<script language="JavaScript">
<!--
function Main() {
var sDB="C:\\Temp\\LOGDB.MDB";
var objConnection = new ActiveXObject("DAO.DBEngine.36");
var objRecordSet = objConnection.workspaces(0).OpenDatabase(sDB);
var iResultCount=0;iCount=0;
var sLineIn = new Array();
var sTransCount="";
var SEARCHRESULT;
sSearchCommand = "SELECT * FROM HL7_Segments WHERE SegmentLineData LIKE
'*MSH*'";
SEARCHRESULT = objRecordSet.OpenRecordset(sSearchCommand)
SEARCHRESULT.MoveFirst();
while (! SEARCHRESULT.EOF) {
sTransCount = SEARCHRESULT("TransactionCount");
sLineIn[iResultCount] = sTransCount;
var msg=confirm("iResultLine for "+iResultCount+" is
"+sLineIn[iResultCount]); if (msg==false) {return;};
iResultCount++;
SEARCHRESULT.MoveNext(); }
for (var iCount=0;iCount<iResultCount;iCount++) {
var msg=confirm("Final iResultLine for "+iCount+" is "+sLineIn[iCount]);
if (msg==false) {return;}; }
objRecordSet.Close;
objRecordSet = Nothing;
objConnection = Nothing;
}
-->
</script>
</head><body><form>
<input type="button" value="Click me!" onclick="Main()">
</form></body></html>
- Follow-Ups:
- [Javascript] Re: While statement array losing data
- From: Tim Lewis
- [Javascript] While statement array losing data
- From: Nick Fitzsimons
- [Javascript] Re: While statement array losing data
- References:
- [Javascript] Replace Characters
- From: Tim Lewis
- [Javascript] Replace Characters
- Prev by Date: [Javascript] Replace Characters
- Next by Date: [Javascript] Re: While statement array losing data
- Previous by thread: [Javascript] Replace Characters
- Next by thread: [Javascript] Re: While statement array losing data
- Index(es):