Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

repost ... Desktop database update app.

Status
Not open for further replies.

BowlerBob

Programmer
Jan 16, 2003
21
GB

Hi

Has anyone written a "freestanding/desktop" database update app in JavaScript ?
ie: one that is can be used on someone's (webmaster?) PC to update records in a database.

Some people will probably shout "VB6", "VBScript" or "AccessVB" but I don't know enough about them to create the screens and processes.


I am hoping not to use serverside as it is not a web or intranetnet application.
My intention is to create a desktop application in JavaScript, as you would in VB6 or AccessVB.
Does it have to be done using serverside script routines ?


An example to work from would be great.



regards

BowlerBob
 
I think this can be done (but I'm not sure) using the same syntax as in ASP code. Let's look at an ASP typical code :
Code:
<%
Dim cnx
Dim rs
Dim Sql
Dim Lib
Dim UserId
Const CONNECTSTRING = &quot;DSN=....&quot;

  UserId = &quot;Tek-tip&quot;

  Set cnx = CreateObject(&quot;ADODB.Connection&quot;)
  cnx.Open CONNECTSTRING
  Set rs = CreateObject(&quot;ADODB.Recordset&quot;)

  Sql = &quot;SELECT   Utl_Nom, Utl_Prenom &quot; & _
        &quot;FROM   Utilisateur &quot; & _
        &quot;WHERE  Utl_Id = '&quot; & UserId & &quot;';&quot;
  rs.Open Sql, cnx
    
  If Not rs.EOF Then
    rs.MoveFirst
    Lib = rs.Fields(&quot;Utl_Nom&quot;) & &quot; &quot; & rs.Fields(&quot;Utl_Prenom&quot;)
  End If
  rs.Close
%>

If you've got the good ODBC data source on your system, I think that you can instanciate and use the same activeX in javaScript the same way :
Code:
const CONNECTSTRING = &quot;DSN=....&quot;;
var cnx = new ActiveX(&quot;ADODB.Connection&quot;);
cnx.Open (CONNECTSTRING);
var rs = new ActiveX(&quot;ADODB.Recordset&quot;);
var UserId = &quot;Tek-tip&quot;;
var Sql = &quot;SELECT Utl_Nom, Utl_Prenom FROM   Utilisateur WHERE  Utl_Id = '&quot; + UserId + &quot;';&quot;;
var Lib;

rs.Open (Sql, cnx);
    
if !(rs.EOF) {
    rs.MoveFirst();
    Lib = rs.Fields(&quot;Utl_Nom&quot;) + &quot; &quot; + rs.Fields(&quot;Utl_Prenom&quot;);
}
rs.Close();

This code has not been &quot;Bug free&quot; tested but I think that it should almost work. Water is not bad as long as it stays out human body ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top