Connecting Tech Pros Worldwide Forums | Help | Site Map

HTML Application - Can Javascript write to a local database?

Mike Preston
Guest
 
Posts: n/a
#1: Jul 23 '05
IE 6.0 (not interested in other browsers at the moment)

I have looked everywhere I can find to look and googled until I am
cross-eyed and am hoping somebody knows what I'm doing wrong.

I have an HTML application (.hta) working fine, except one thing. I'm
trying to write to a local database from a .htm window (opened from
the main .hta window) and it doesn't work with any of the combinations
I've tried (and I admit to having tried a lot).

Here is one method I've tried:

strSQL = "Update myTable SET myField = 'myValue' WHERE myID = 12;"
var db = new ActiveXObject("ADODB.Connection");
db.Provider = "Microsoft.Jet.OLEDB.4.0";0
db.ConnectionString = "Data Source='c:\\myDirectory\\myDatabase.mdb'";
db.Open;
db.execute(strSQL);

I can easily access the information in the myDatabase.mdb and display
it on the screen.

I can ask for updated information to be input on the screen.

But stuffing that updated information back into the database is the
problem.

Since I'm stuck in an .htm window, I don't have VBScript available, do
I? If VBScript isn't available and it isn't physically possible with
Javascript, then I'll have to revert to .hta windows, where I know I
have VBScript available. But I'd rather do it all in Javascript
within the .htm so as to avoid the security message that pops up when
the .hta opens a new .hta. For various reasons I don't think it is
possible for me to do this whole project within a single .hta.

Thanks

mike

Mike Preston
Guest
 
Posts: n/a
#2: Jul 23 '05

re: HTML Application - Can Javascript write to a local database?


In case this isn't the right newsgroup, could somebody suggest one
that might be a better place to post this?

Thanks

mike


On Mon, 03 May 2004 08:36:44 GMT, mbpatpas.invalid@pacbell.net (Mike
Preston) wrote:
[color=blue]
>IE 6.0 (not interested in other browsers at the moment)
>
>I have looked everywhere I can find to look and googled until I am
>cross-eyed and am hoping somebody knows what I'm doing wrong.
>
>I have an HTML application (.hta) working fine, except one thing. I'm
>trying to write to a local database from a .htm window (opened from
>the main .hta window) and it doesn't work with any of the combinations
>I've tried (and I admit to having tried a lot).
>
>Here is one method I've tried:
>
>strSQL = "Update myTable SET myField = 'myValue' WHERE myID = 12;"
>var db = new ActiveXObject("ADODB.Connection");
>db.Provider = "Microsoft.Jet.OLEDB.4.0";0
>db.ConnectionString = "Data Source='c:\\myDirectory\\myDatabase.mdb'";
>db.Open;
>db.execute(strSQL);
>
>I can easily access the information in the myDatabase.mdb and display
>it on the screen.
>
>I can ask for updated information to be input on the screen.
>
>But stuffing that updated information back into the database is the
>problem.
>
>Since I'm stuck in an .htm window, I don't have VBScript available, do
>I? If VBScript isn't available and it isn't physically possible with
>Javascript, then I'll have to revert to .hta windows, where I know I
>have VBScript available. But I'd rather do it all in Javascript
>within the .htm so as to avoid the security message that pops up when
>the .hta opens a new .hta. For various reasons I don't think it is
>possible for me to do this whole project within a single .hta.
>
>Thanks
>
>mike[/color]

MikeB
Guest
 
Posts: n/a
#3: Jul 23 '05

re: HTML Application - Can Javascript write to a local database?



"Mike Preston" <mbpatpas.invalid@pacbell.net> wrote in message
news:4096882c.201313102@news.INDIVIDUAL.NET...[color=blue]
> In case this isn't the right newsgroup, could somebody suggest one
> that might be a better place to post this?[/color]

I think you can ask in this NG. The first thing that leaps to mind is why the window that is opened by
the hta is not also an hta instead of htm.
[color=blue]
> Thanks
>
> mike
>
>
> On Mon, 03 May 2004 08:36:44 GMT, mbpatpas.invalid@pacbell.net (Mike
> Preston) wrote:
>[color=green]
> >IE 6.0 (not interested in other browsers at the moment)
> >
> >I have looked everywhere I can find to look and googled until I am
> >cross-eyed and am hoping somebody knows what I'm doing wrong.
> >
> >I have an HTML application (.hta) working fine, except one thing. I'm
> >trying to write to a local database from a .htm window (opened from
> >the main .hta window) and it doesn't work with any of the combinations
> >I've tried (and I admit to having tried a lot).
> >
> >Here is one method I've tried:
> >
> >strSQL = "Update myTable SET myField = 'myValue' WHERE myID = 12;"
> >var db = new ActiveXObject("ADODB.Connection");
> >db.Provider = "Microsoft.Jet.OLEDB.4.0";0
> >db.ConnectionString = "Data Source='c:\\myDirectory\\myDatabase.mdb'";
> >db.Open;
> >db.execute(strSQL);
> >
> >I can easily access the information in the myDatabase.mdb and display
> >it on the screen.
> >
> >I can ask for updated information to be input on the screen.
> >
> >But stuffing that updated information back into the database is the
> >problem.
> >
> >Since I'm stuck in an .htm window, I don't have VBScript available, do
> >I? If VBScript isn't available and it isn't physically possible with
> >Javascript, then I'll have to revert to .hta windows, where I know I
> >have VBScript available. But I'd rather do it all in Javascript
> >within the .htm so as to avoid the security message that pops up when
> >the .hta opens a new .hta. For various reasons I don't think it is
> >possible for me to do this whole project within a single .hta.
> >
> >Thanks
> >
> >mike[/color]
>[/color]


Mike Preston
Guest
 
Posts: n/a
#4: Jul 23 '05

re: HTML Application - Can Javascript write to a local database?


Thanks for the reply, MikeB. See below for response.

On Mon, 3 May 2004 13:47:06 -0500, "MikeB"
<m.byerleyATVerizonDottieNettie> wrote:
[color=blue]
>
>"Mike Preston" <mbpatpas.invalid@pacbell.net> wrote in message
>news:4096882c.201313102@news.INDIVIDUAL.NET...[color=green]
>> In case this isn't the right newsgroup, could somebody suggest one
>> that might be a better place to post this?[/color]
>
>I think you can ask in this NG. The first thing that leaps to mind is why the window that is opened by
>the hta is not also an hta instead of htm.[/color]

"But I'd rather do it all in Javascript within the .htm so as to avoid
the security message that pops up when the .hta opens a new .hta."

I can open the second window as an .hta, but if I do that, I get a
security message about downloading dangerous files, etc. Kind of a
strange message for something that never goes outside the PC itself.

mike
[color=blue][color=green]
>> On Mon, 03 May 2004 08:36:44 GMT, mbpatpas.invalid@pacbell.net (Mike
>> Preston) wrote:
>>[color=darkred]
>> >IE 6.0 (not interested in other browsers at the moment)
>> >
>> >I have looked everywhere I can find to look and googled until I am
>> >cross-eyed and am hoping somebody knows what I'm doing wrong.
>> >
>> >I have an HTML application (.hta) working fine, except one thing. I'm
>> >trying to write to a local database from a .htm window (opened from
>> >the main .hta window) and it doesn't work with any of the combinations
>> >I've tried (and I admit to having tried a lot).
>> >
>> >Here is one method I've tried:
>> >
>> >strSQL = "Update myTable SET myField = 'myValue' WHERE myID = 12;"
>> >var db = new ActiveXObject("ADODB.Connection");
>> >db.Provider = "Microsoft.Jet.OLEDB.4.0";0
>> >db.ConnectionString = "Data Source='c:\\myDirectory\\myDatabase.mdb'";
>> >db.Open;
>> >db.execute(strSQL);
>> >
>> >I can easily access the information in the myDatabase.mdb and display
>> >it on the screen.
>> >
>> >I can ask for updated information to be input on the screen.
>> >
>> >But stuffing that updated information back into the database is the
>> >problem.
>> >
>> >Since I'm stuck in an .htm window, I don't have VBScript available, do
>> >I? If VBScript isn't available and it isn't physically possible with
>> >Javascript, then I'll have to revert to .hta windows, where I know I
>> >have VBScript available. But I'd rather do it all in Javascript
>> >within the .htm so as to avoid the security message that pops up when
>> >the .hta opens a new .hta. For various reasons I don't think it is
>> >possible for me to do this whole project within a single .hta.
>> >
>> >Thanks
>> >
>> >mike[/color]
>>[/color]
>
>[/color]

Brian Genisio
Guest
 
Posts: n/a
#5: Jul 23 '05

re: HTML Application - Can Javascript write to a local database?


Mike Preston wrote:
[color=blue]
> Thanks for the reply, MikeB. See below for response.
>
> On Mon, 3 May 2004 13:47:06 -0500, "MikeB"
> <m.byerleyATVerizonDottieNettie> wrote:
>
>[color=green]
>>"Mike Preston" <mbpatpas.invalid@pacbell.net> wrote in message
>>news:4096882c.201313102@news.INDIVIDUAL.NET...
>>[color=darkred]
>>>In case this isn't the right newsgroup, could somebody suggest one
>>>that might be a better place to post this?[/color]
>>
>>I think you can ask in this NG. The first thing that leaps to mind is why the window that is opened by
>>the hta is not also an hta instead of htm.[/color]
>
>
> "But I'd rather do it all in Javascript within the .htm so as to avoid
> the security message that pops up when the .hta opens a new .hta."
>
> I can open the second window as an .hta, but if I do that, I get a
> security message about downloading dangerous files, etc. Kind of a
> strange message for something that never goes outside the PC itself.
>
> mike
>[/color]

I think you should be looking if there is a way to get rid of the
message (I dont know if it is possible). One of the things that HTA
gives you is the lax security setup. This is precisesly why you can do
something like connect to a database. In a plain HTML page, there is no
way (that I know of) to connect to a local database. That is a security
issue, and the browser says no.

Brian


MikeB
Guest
 
Posts: n/a
#6: Jul 23 '05

re: HTML Application - Can Javascript write to a local database?



"Mike Preston" <mbpatpas.invalid@pacbell.net> wrote in message
news:40969a97.206027882@news.INDIVIDUAL.NET...[color=blue]
> Thanks for the reply, MikeB. See below for response.
>
> On Mon, 3 May 2004 13:47:06 -0500, "MikeB"
> <m.byerleyATVerizonDottieNettie> wrote:
>[color=green]
> >
> >"Mike Preston" <mbpatpas.invalid@pacbell.net> wrote in message
> >news:4096882c.201313102@news.INDIVIDUAL.NET...[color=darkred]
> >> In case this isn't the right newsgroup, could somebody suggest one
> >> that might be a better place to post this?[/color]
> >
> >I think you can ask in this NG. The first thing that leaps to mind is why the window that is opened[/color][/color]
by[color=blue][color=green]
> >the hta is not also an hta instead of htm.[/color]
>
> "But I'd rather do it all in Javascript within the .htm so as to avoid
> the security message that pops up when the .hta opens a new .hta."
>
> I can open the second window as an .hta, but if I do that, I get a
> security message about downloading dangerous files, etc. Kind of a
> strange message for something that never goes outside the PC itself.[/color]

Mike,
It's been awhile, but If you use a frameset, you can have the *.htm in a frame hosted by the original
HTA operate in the security context of the originating HTA, IOW you can access the filesystem, create
activex, etc without the security bitch.

Mike


[color=blue]
>
> mike
>[color=green][color=darkred]
> >> On Mon, 03 May 2004 08:36:44 GMT, mbpatpas.invalid@pacbell.net (Mike
> >> Preston) wrote:
> >>
> >> >IE 6.0 (not interested in other browsers at the moment)
> >> >
> >> >I have looked everywhere I can find to look and googled until I am
> >> >cross-eyed and am hoping somebody knows what I'm doing wrong.
> >> >
> >> >I have an HTML application (.hta) working fine, except one thing. I'm
> >> >trying to write to a local database from a .htm window (opened from
> >> >the main .hta window) and it doesn't work with any of the combinations
> >> >I've tried (and I admit to having tried a lot).
> >> >
> >> >Here is one method I've tried:
> >> >
> >> >strSQL = "Update myTable SET myField = 'myValue' WHERE myID = 12;"
> >> >var db = new ActiveXObject("ADODB.Connection");
> >> >db.Provider = "Microsoft.Jet.OLEDB.4.0";0
> >> >db.ConnectionString = "Data Source='c:\\myDirectory\\myDatabase.mdb'";
> >> >db.Open;
> >> >db.execute(strSQL);
> >> >
> >> >I can easily access the information in the myDatabase.mdb and display
> >> >it on the screen.
> >> >
> >> >I can ask for updated information to be input on the screen.
> >> >
> >> >But stuffing that updated information back into the database is the
> >> >problem.
> >> >
> >> >Since I'm stuck in an .htm window, I don't have VBScript available, do
> >> >I? If VBScript isn't available and it isn't physically possible with
> >> >Javascript, then I'll have to revert to .hta windows, where I know I
> >> >have VBScript available. But I'd rather do it all in Javascript
> >> >within the .htm so as to avoid the security message that pops up when
> >> >the .hta opens a new .hta. For various reasons I don't think it is
> >> >possible for me to do this whole project within a single .hta.
> >> >
> >> >Thanks
> >> >
> >> >mike
> >>[/color]
> >
> >[/color]
>[/color]


Mike Preston
Guest
 
Posts: n/a
#7: Jul 23 '05

re: HTML Application - Can Javascript write to a local database?


On Mon, 03 May 2004 15:41:43 -0400, Brian Genisio
<BrianGenisio@yahoo.com> wrote:

Brian, thanks for taking the time to respond. See below.
[color=blue]
>Mike Preston wrote:
>[color=green]
>> Thanks for the reply, MikeB. See below for response.
>>
>> On Mon, 3 May 2004 13:47:06 -0500, "MikeB"
>> <m.byerleyATVerizonDottieNettie> wrote:
>>
>>[color=darkred]
>>>"Mike Preston" <mbpatpas.invalid@pacbell.net> wrote in message
>>>news:4096882c.201313102@news.INDIVIDUAL.NET.. .
>>>
>>>>In case this isn't the right newsgroup, could somebody suggest one
>>>>that might be a better place to post this?
>>>
>>>I think you can ask in this NG. The first thing that leaps to mind is why the window that is opened by
>>>the hta is not also an hta instead of htm.[/color]
>>
>>
>> "But I'd rather do it all in Javascript within the .htm so as to avoid
>> the security message that pops up when the .hta opens a new .hta."
>>
>> I can open the second window as an .hta, but if I do that, I get a
>> security message about downloading dangerous files, etc. Kind of a
>> strange message for something that never goes outside the PC itself.
>>[/color]
>
>I think you should be looking if there is a way to get rid of the
>message (I dont know if it is possible).[/color]

I don't believe there is.
[color=blue]
> One of the things that HTA
>gives you is the lax security setup. This is precisesly why you can do
>something like connect to a database. In a plain HTML page, there is no
>way (that I know of) to connect to a local database. That is a security
>issue, and the browser says no.[/color]

Well, from within the .htm I can "connect" just fine. I can read the
database and display a recordset. It is just updating it that it
won't let me do (so far!).

Does the fact that I can read the database lead you to believe that I
can also udpate the database? That is, is it just my syntax that is
incorrect? Or does the fact that I'm using an .htm preclude updating
of the database, even though I can read it just fine?

Thanks

mike[color=blue]
>[/color]

Mike Preston
Guest
 
Posts: n/a
#8: Jul 23 '05

re: HTML Application - Can Javascript write to a local database?


On Mon, 3 May 2004 15:38:49 -0500, "MikeB"
<m.byerleyATVerizonDottieNettie> wrote:
[color=blue]
>
>"Mike Preston" <mbpatpas.invalid@pacbell.net> wrote in message
>news:40969a97.206027882@news.INDIVIDUAL.NET...[color=green]
>> Thanks for the reply, MikeB. See below for response.
>>
>> On Mon, 3 May 2004 13:47:06 -0500, "MikeB"
>> <m.byerleyATVerizonDottieNettie> wrote:
>>[color=darkred]
>> >
>> >"Mike Preston" <mbpatpas.invalid@pacbell.net> wrote in message
>> >news:4096882c.201313102@news.INDIVIDUAL.NET...
>> >> In case this isn't the right newsgroup, could somebody suggest one
>> >> that might be a better place to post this?
>> >
>> >I think you can ask in this NG. The first thing that leaps to mind is why the window that is opened[/color][/color]
>by[color=green][color=darkred]
>> >the hta is not also an hta instead of htm.[/color]
>>
>> "But I'd rather do it all in Javascript within the .htm so as to avoid
>> the security message that pops up when the .hta opens a new .hta."
>>
>> I can open the second window as an .hta, but if I do that, I get a
>> security message about downloading dangerous files, etc. Kind of a
>> strange message for something that never goes outside the PC itself.[/color]
>
>Mike,
> It's been awhile, but If you use a frameset, you can have the *.htm in a frame hosted by the original
>HTA operate in the security context of the originating HTA, IOW you can access the filesystem, create
>activex, etc without the security bitch.[/color]

Thanks for the reply, Mike. Yes, I might have to go with a frame in
the original .hta. I'm pretty sure that would do exactly as you
describe ==> allow the security parameters to be controlled by the
hta window.

But I'm still holding out hope that somebody will see that my syntax
is wrong and give me the key to updating information from an .htm
spawned by an .hta.

Thanks, again.

mike
[color=blue][color=green][color=darkred]
>> >> On Mon, 03 May 2004 08:36:44 GMT, mbpatpas.invalid@pacbell.net (Mike
>> >> Preston) wrote:
>> >>
>> >> >IE 6.0 (not interested in other browsers at the moment)
>> >> >
>> >> >I have looked everywhere I can find to look and googled until I am
>> >> >cross-eyed and am hoping somebody knows what I'm doing wrong.
>> >> >
>> >> >I have an HTML application (.hta) working fine, except one thing. I'm
>> >> >trying to write to a local database from a .htm window (opened from
>> >> >the main .hta window) and it doesn't work with any of the combinations
>> >> >I've tried (and I admit to having tried a lot).
>> >> >
>> >> >Here is one method I've tried:
>> >> >
>> >> >strSQL = "Update myTable SET myField = 'myValue' WHERE myID = 12;"
>> >> >var db = new ActiveXObject("ADODB.Connection");
>> >> >db.Provider = "Microsoft.Jet.OLEDB.4.0";0
>> >> >db.ConnectionString = "Data Source='c:\\myDirectory\\myDatabase.mdb'";
>> >> >db.Open;
>> >> >db.execute(strSQL);
>> >> >
>> >> >I can easily access the information in the myDatabase.mdb and display
>> >> >it on the screen.
>> >> >
>> >> >I can ask for updated information to be input on the screen.
>> >> >
>> >> >But stuffing that updated information back into the database is the
>> >> >problem.
>> >> >
>> >> >Since I'm stuck in an .htm window, I don't have VBScript available, do
>> >> >I? If VBScript isn't available and it isn't physically possible with
>> >> >Javascript, then I'll have to revert to .hta windows, where I know I
>> >> >have VBScript available. But I'd rather do it all in Javascript
>> >> >within the .htm so as to avoid the security message that pops up when
>> >> >the .hta opens a new .hta. For various reasons I don't think it is
>> >> >possible for me to do this whole project within a single .hta.
>> >> >
>> >> >Thanks
>> >> >
>> >> >mike
>> >>
>> >
>> >[/color]
>>[/color]
>
>[/color]

MikeB
Guest
 
Posts: n/a
#9: Jul 23 '05

re: HTML Application - Can Javascript write to a local database?



"Mike Preston" <mbpatpas.invalid@pacbell.net> wrote in message
news:4096afb3.211432043@news.INDIVIDUAL.NET...[color=blue]
> On Mon, 3 May 2004 15:38:49 -0500, "MikeB"
> <m.byerleyATVerizonDottieNettie> wrote:
>[color=green]
> >
> >"Mike Preston" <mbpatpas.invalid@pacbell.net> wrote in message
> >news:40969a97.206027882@news.INDIVIDUAL.NET...[color=darkred]
> >> Thanks for the reply, MikeB. See below for response.
> >>
> >> On Mon, 3 May 2004 13:47:06 -0500, "MikeB"
> >> <m.byerleyATVerizonDottieNettie> wrote:
> >>
> >> >
> >> >"Mike Preston" <mbpatpas.invalid@pacbell.net> wrote in message
> >> >news:4096882c.201313102@news.INDIVIDUAL.NET...
> >> >> In case this isn't the right newsgroup, could somebody suggest one
> >> >> that might be a better place to post this?
> >> >
> >> >I think you can ask in this NG. The first thing that leaps to mind is why the window that is[/color][/color][/color]
opened[color=blue][color=green]
> >by[color=darkred]
> >> >the hta is not also an hta instead of htm.
> >>
> >> "But I'd rather do it all in Javascript within the .htm so as to avoid
> >> the security message that pops up when the .hta opens a new .hta."
> >>
> >> I can open the second window as an .hta, but if I do that, I get a
> >> security message about downloading dangerous files, etc. Kind of a
> >> strange message for something that never goes outside the PC itself.[/color]
> >
> >Mike,
> > It's been awhile, but If you use a frameset, you can have the *.htm in a frame hosted by the[/color][/color]
original[color=blue][color=green]
> >HTA operate in the security context of the originating HTA, IOW you can access the filesystem, create
> >activex, etc without the security bitch.[/color]
>
> Thanks for the reply, Mike. Yes, I might have to go with a frame in
> the original .hta. I'm pretty sure that would do exactly as you
> describe ==> allow the security parameters to be controlled by the
> hta window.
>
> But I'm still holding out hope that somebody will see that my syntax
> is wrong and give me the key to updating information from an .htm
> spawned by an .hta.[/color]

If you use window.open to spawn your new page, the new page is going to be hosted by IE and everything in
that page is going to have to run in IE security context.


Mike Preston
Guest
 
Posts: n/a
#10: Jul 23 '05

re: HTML Application - Can Javascript write to a local database?


On Mon, 3 May 2004 18:08:06 -0500, "MikeB"
<m.byerleyATVerizonDottieNettie> wrote:
[color=blue]
>If you use window.open to spawn your new page, the new page is going to be hosted by IE and everything in
>that page is going to have to run in IE security context.[/color]

Indeed. That was the solution. Many thanks.

mike
Closed Thread


Similar JavaScript / Ajax / DHTML bytes