DATABASE & HTML


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: DATABASE & HTML

Hybrid View

  1. #1
    Stryker Guest

    DATABASE & HTML

    Hi
    My problem is this:
    I have an Access Database wich I connect to Using ADO.
    I want to change a certain String of text ( hello ) in the HTML file to the
    Text in one of My Database Fields.

    When I change the text without connecting to the Database it works fine.
    Below is the code as I have it now. At the moment I just get the Temp.htm
    but it turns blank ( it has the default "hello" in there to start of with)

    Can someone help me please?

    Dim cn As ADODB.Connection
    Dim rs As ADODB.Recordset
    Dim cmd As String
    Dim sql As String

    cmd = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path &
    "\dbWimCd.mdb"
    Set cn = New ADODB.Connection
    cn.ConnectionString = cmd
    cn.Open

    sql = " SELECT * FROM CD"
    Set rs = New ADODB.Recordset
    rs.Open sql, cn, adOpenForwardOnly, adLockOptimistic
    Do While Not rs.EOF
    KK = rs("CDName")
    Loop

    cn.Close
    Set cn = Nothing


    Open App.Path & "\HTML\cview.htm" For Input As #1
    Open App.Path & "\HTML\temp.htm" For Output As #2
    Line Input #1, Temp
    Temp = Replace(Temp, "hello", KK)
    Print #2, Temp
    Loop
    Close #2
    Close #1


    End Sub



  2. #2
    Arthur Wood Guest

    Re: DATABASE & HTML


    In order for a Web Page to ba eable to access "live" data from a database,
    you MUST use either Perl/CGI or Active Server Pages (your page wuold end
    with .asp, rather than .htm(l))

    I would sugest that you might want to purchase a copy of

    Beginning Active Server Pages 3.0
    by Buser, Francis and Kaufman
    WROX Press
    ISBN 1861003382
    should run about $30 US (Barnes & Noble .com : http://www.bn.com/

    Arthur Wood

    "Stryker" <admin@datorline.co.za> wrote:
    >Hi
    >My problem is this:
    >I have an Access Database wich I connect to Using ADO.
    >I want to change a certain String of text ( hello ) in the HTML file to

    the
    >Text in one of My Database Fields.
    >
    >When I change the text without connecting to the Database it works fine.
    >Below is the code as I have it now. At the moment I just get the Temp.htm
    >but it turns blank ( it has the default "hello" in there to start of with)
    >
    >Can someone help me please?
    >
    >Dim cn As ADODB.Connection
    >Dim rs As ADODB.Recordset
    >Dim cmd As String
    >Dim sql As String
    >
    >cmd = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path &
    >"\dbWimCd.mdb"
    >Set cn = New ADODB.Connection
    > cn.ConnectionString = cmd
    > cn.Open
    >
    >sql = " SELECT * FROM CD"
    >Set rs = New ADODB.Recordset
    > rs.Open sql, cn, adOpenForwardOnly, adLockOptimistic
    > Do While Not rs.EOF
    > KK = rs("CDName")
    >Loop
    >
    >cn.Close
    >Set cn = Nothing
    >
    >
    >Open App.Path & "\HTML\cview.htm" For Input As #1
    >Open App.Path & "\HTML\temp.htm" For Output As #2
    >Line Input #1, Temp
    >Temp = Replace(Temp, "hello", KK)
    >Print #2, Temp
    >Loop
    >Close #2
    >Close #1
    >
    >
    >End Sub
    >
    >



  3. #3
    Russ Guest

    Re: DATABASE & HTML


    "Arthur Wood" <wooda@saic-trsc.com> wrote:
    >
    >you MUST use either Perl/CGI or Active Server Pages
    >


    There are a few other alternatives here. What about Code Fusion or PSP?



  4. #4
    Russ Guest

    Re: DATABASE & HTML


    "Russ" <russell.thompson@adlink.com> wrote:
    >
    >"Arthur Wood" <wooda@saic-trsc.com> wrote:
    >>
    >>you MUST use either Perl/CGI or Active Server Pages
    >>

    >
    >There are a few other alternatives here. What about Code Fusion or PSP?
    >
    >

    Sorry, meant PHP.

  5. #5
    Gunawan Guest

    Re: DATABASE & HTML

    assign "hello" to var KK as you assing value of CDName

    This this HTTM <=%KK%> an so on


    "Stryker" <admin@datorline.co.za> wrote in message
    news:3bdd49e8@news.devx.com...
    > Hi
    > My problem is this:
    > I have an Access Database wich I connect to Using ADO.
    > I want to change a certain String of text ( hello ) in the HTML file to

    the
    > Text in one of My Database Fields.
    >
    > When I change the text without connecting to the Database it works fine.
    > Below is the code as I have it now. At the moment I just get the Temp.htm
    > but it turns blank ( it has the default "hello" in there to start of with)
    >
    > Can someone help me please?
    >
    > Dim cn As ADODB.Connection
    > Dim rs As ADODB.Recordset
    > Dim cmd As String
    > Dim sql As String
    >
    > cmd = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path &
    > "\dbWimCd.mdb"
    > Set cn = New ADODB.Connection
    > cn.ConnectionString = cmd
    > cn.Open
    >
    > sql = " SELECT * FROM CD"
    > Set rs = New ADODB.Recordset
    > rs.Open sql, cn, adOpenForwardOnly, adLockOptimistic
    > Do While Not rs.EOF
    > KK = rs("CDName")
    > Loop
    >
    > cn.Close
    > Set cn = Nothing
    >
    >
    > Open App.Path & "\HTML\cview.htm" For Input As #1
    > Open App.Path & "\HTML\temp.htm" For Output As #2
    > Line Input #1, Temp
    > Temp = Replace(Temp, "hello", KK)
    > Print #2, Temp
    > Loop
    > Close #2
    > Close #1
    >
    >
    > End Sub
    >
    >




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center