Hi,
i know this is the vb forum but dont know of any good javascript forum so thought i would rack the brains of the good javascripters.
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
www.js-x.com is a great JS forum (where I moderate). That said, there are plenty of amazing people here who should be able to help you.
you see it needs to look at the MSdatabase that is on a local server
I'm fairly sure that you'll need IIS installed on all your visitors PCs for this to work, you'd then have to configure their settings to how you need them (where the database is located etc). Then they'd have to download the file and run it from their localhost.
and write to it
i am thinkin that perhaps using vbscript and javascript
Neither can write to files at all.
in A EXTERNAL Javascript file
so in a sense,
1) ill open the database connection
JS cannot open a DB connection, nor can it read/write to it.
5) then send it to the database using a vbscript, or javascript if possible.
can you take a look a this, is code to open a database, if i can open a database, and call an alert, it cant be to much to write to a field. now if i open the connection the same way in vbscript.
[code]
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
}
[/Highlight]
i have something for you gues to look at, at work we have a predicted dialer. it generates call. now there pages are view via webbrower. take a look at the attached files and you'll see its possible problem is i dont understand it to use the same file myself just modify it to do what i want.
if you could take a look and perhaps have it running with access coz this is on sql but i dont really know enough som im learning as well from what i see :d
I have some working code to find all the elements in a html file
and there values. ok there is on stage complete.
no if i find how to connect to a database then using this code i can send all the types i request to a local database.
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Untitled Document</title>
<script type="text/javascript">
function identify_Elems(){
var f = document.forms;
for(i=0; i<f.length; i++){
for(j=0; j<f[i].elements.length; j++){
alert("Type: "+f[i].elements[j].type+
"\nName: "+f[i].elements[j].name+
"\nValue: "+f[i].elements[j].value+
"\nChild of form: "+ i);
}
}
}
</script>
</head>
<body>
<form action="file.php" method="post" onsubmit="identify_Elems(); return false;"><div>
Text box #1: <input type="text" name="t1" value="Text"><br>
Text box #2: <input type="text" name="t2" value="Text"><br>
Select box #1: <select size="1" name="s1">
<option value="-1">Select</option>
<option value="1">Option </option>
<option value="2">Option </option>
</select><br>
<input type="submit" name="submit" value="Submit">
</div></form>
</body>
</html>
So now what will be the best way to connect to a database. It has to be possible :d
Originally posted by k0r54 It has to be possible :d
Tnx AdZ
Why? Why does it *have* to be possible? Why can't it be impossible?
Actually, there is a way..... or rather there used to be a way. It's called Remote Processing Call or RPC..... but there is a reason no one uses it, and even Microsoft (who originally helped develop the consept) doesn't recommend it (and hasn't recommended it for at least 5 years or so.) It's slow, it's clumsy and it isn't easy to set up or use.
Before you can ask, no, I *don't* know how to do it. I haven't done an RPC setup in over 6 years and the knowledge is gone.
You could try a Google search, but I don't know what you will find that will be of anyuse.