-
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
-
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
>
>
-
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?
-
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.
-
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
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks