Wrox Programmer Forums
|
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 24th, 2005, 09:08 PM
Registered User
 
Join Date: Jan 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Reading a MS-Access table:

Hello, I have an ASP page and would like to connect to a table in MS-Access and read from it. How do I do that?

Thanks in advance,
Peter

 
Old January 24th, 2005, 09:23 PM
Friend of Wrox
 
Join Date: May 2004
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

Please check the following URL:

http://www.scit.wlv.ac.uk/~jphb/sst/asp/asp3.html

Om Prakash
 
Old January 24th, 2005, 09:41 PM
Registered User
 
Join Date: Jan 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your quick reply. I was actually thinking of using JS to do this. The reason is I have a scroller (in JS code) and would like to get the data from the MS-Access, then display them in the scrolling area.

 
Old January 24th, 2005, 10:13 PM
Friend of Wrox
 
Join Date: May 2004
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

You have to read the data from the database as mentioned in the above example (Link), and then store the contents in a variable from server side script and assign this to a javascript scroller variable, which is used.

Om Prakash
 
Old January 24th, 2005, 11:06 PM
Registered User
 
Join Date: Jan 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I really appreciated it. I got it to work!!!!!

Thanks again,
Peter

 
Old January 28th, 2005, 10:04 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 290
Thanks: 24
Thanked 0 Times in 0 Posts
Default

Hi Peter,

I was wondering if you could share your code with us in the forum. You said you got it to work and I think everyone would like to see that.

Cheers,

Claudio


 
Old February 2nd, 2005, 11:08 AM
Registered User
 
Join Date: Jan 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Pallone, absolutely!! But because of lot's of codes, I'll put a snippet of it.
<HEAD>
<%
    set Conn = Server.CreateObject("ADODB.Connection")
    Conn.ConnectionTimeout = 20
    Conn.Mode = 8
    Conn.Open "MyConnection"
    strSql = "select title1, description1, title2, description2,title3, description3 from specialAnnouncements "
    set Rec = Server.CreateObject("ADODB.RecordSet")
    ... and so on.. bla,blah

    Rec.Open StrSql
    if Not Rec.BOF then
        Do While Not Rec.EOF
%>
<SCRIPT LANGUAGE="JavaScript">

</script>
<%
   Rec.MoveNext
   Loop
   end if
  Rec.Close()
  Set Rec = Nothing
%>
</HEAD>

In my include js file, all it does is display a scrolling text and here are my code snippet that gets it from my ASP object:

var displayText = new Array()
displayText[0]='<div align="Left"><b>[u]<center><%=Rec("title3")%></center></u></b><br><%=Rec("description3")%></div><br>'+
              '<div align="Left"><b>[u]<center><%=Rec("title1")%></center></u></b><br><%=Rec("description1")%></div><br>'+
              '<div align="Left"><b>[u]<center><%=Rec("title2")%></center></u></b><br><%=Rec("description2")%></div>'

There you have it and thanks for Mr. Prakash's help.

 
Old February 2nd, 2005, 03:22 PM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 290
Thanks: 24
Thanked 0 Times in 0 Posts
Default

Peter,

Thanks a lot.

I can now see how you are mixing javascript with asp. But what about scrolling the messages?? how do you that?

Cheers,

Claudio

 
Old February 3rd, 2005, 02:10 PM
Registered User
 
Join Date: Jan 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Claudio,

I got the codes from here. http://javascript.internet.com/scrolls/

Peter

 
Old February 7th, 2005, 08:12 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 290
Thanks: 24
Thanked 0 Times in 0 Posts
Default

thanks Peter :)






Similar Threads
Thread Thread Starter Forum Replies Last Post
join table using ms access ct VB.NET 1 October 23rd, 2006 03:16 PM
how do I store forms in an MS Access table? neuralsea Access VBA 1 August 14th, 2004 04:34 PM
How to create table in Ms Access (TSQL) abdusalam SQL Server 2000 4 July 31st, 2004 01:54 AM
How to clone MS Access table in C# cameleon69 C# 0 January 21st, 2004 10:16 AM
MS Access Table Help Imran82 BOOK: Beginning Access VBA 0 December 23rd, 2003 08:17 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.