SQL querys on local HTML files using JavaScript?

J

Joe Doe

Hi!

I've got a site on ASP, generating pages dynamically from querys to an
SQL Server database. You know, the typical products table, etc.

Now I need to make a CD version of the site, so the ASP pages will be
translated to HTML pages that will be executed directly from the CD,
without a web server.

So, what I've done is translate the tables to bidimensional JavaScript
arrays, I have now a file called "products.js" that generates the
product table on an array, on this way:

// -------------------
p=new Array(203);

for(j=0;j<203;j++)
{
p[j]=new Array(8);
}

p[0][0]="5";
p[0][1]="A001";
p[0][2]="DESCRIPTION OF THIS PRODUCT";
p[0][3]="02";
p[0][4]="0";
p[0][5]="20";
p[0][6]="False";
p[0][7]="ENF";

p[1][0]="239";
p[1][1]="B014";
p[1][2]="ANOTHER PRODUCT";
p[1][3]="08";
p[1][4]="2487";
p[1][5]="500";
p[1][6]="True";
p[1][7]="SPU";

// --------------------- etc...

This way, having an HTML page that looks for the details of a given
product by its ID (column p[0]) is really easy to do, just loop the
array looking for this ID, and return the values stored there.

That's OK for simple pages like this one, but the site also has a search
form, to find products using complex queries like "give me all products
that contain the word 'useful' on its description, having blue colour,
being in stock, with manufacture date between this and that date, etc.".
This is quite easy to do with SQL, but how could I do this when I have
several tables that have been translated to JavaScript bidimensional arrays?

Is there any kit that would let me do standard SQL queries on
JavaScript/HTML local files?

I've been reading about XML for <SCRIPT>:

http://xmljs.sourceforge.net/

that might be good for me, but is there any other simpler tool?

Thanks a lot,

Joe
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top