WebDeveloper.com

WebDeveloper.com (http://www.webdeveloper.com/forum/index.php)
-   JavaScript (http://www.webdeveloper.com/forum/forumdisplay.php?f=3)
-   -   DataBase Theory (http://www.webdeveloper.com/forum/showthread.php?t=37540)

k0r54 06-17-2004 03:51 AM

DataBase Theory
 
Hi,

I am trying to create database access to a MSDatabase the problem is that, it needs to be NON server side, you see it needs to look at the MSdatabase that is on a local server, and write to it :)

i am thinkin that perhaps using vbscript and javascript

in A EXTERNAL Javascript file

so in a sense,
1) ill open the database connection
2) get the javascript to create a variable for each item i.e text box on a html page or picklist, it will create a variable for each one until there is no more,

i.e

var TB(1) --> (Name) 'first text box in the html page
var TB(2) --> (Surename) ' second
var PL(1) --> (Q1) 'first pick list in the html page

until there is no more left, coz the amount of text box or picklist on a page will change

3) then in the html page, put in something at the (Name) text box that tells what field in the MSDatabase the string has to go into.

i.e Var TB(1) --> (Name,Field1)

4) then gather up the contents of all the variables, i.e whats in the picklist, or text box

ie VarTB(1) --> (Name,Field1,Adam)

5) then send it to the database using a vbscript, or javascript if possible.

Is this theory possible, i know to connect to a MSDatabase using ododb, but not sure on the other stuff, but intend to hit the books and the forum :d

k0r54 06-17-2004 05:44 AM

To access the database the code is

function Query(){
var Database = new ActiveXObject("ADODB.Connection");
Database.Provider = "Microsoft.Jet.OLEDB.4.0";
Database.ConnectionString = "Data Source=data.mdb";
Database.Open;
RS = new ActiveXObject("ADODB.Recordset");
RS.ActiveConnection = dbc;
RS.CursorLocation = 3;
RS.LockType = 3;
RS.Open ("Select * FROM TBLSTUFF");
window.alert(RS.fieldname);
RS.close
Database.close
}

i mean this is a start any idea's for expansion. or code that might help :)


All times are GMT -5. The time now is 01:26 PM.

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.