I want to save html source code into Acess database using VB
Printable View
I want to save html source code into Acess database using VB
Hi friend,
just add the Mircorsft internet transfer control in ur VB form.
and add the textbox and make it multiline property = true
then write the code.
Text1.Text = Intel.OpenURL("http://www.yahoo.com")
it'll store the all source code to textbox
from text box u can update to database
thanks
Bala
Prelude Solution Providers (P) Ltd.
Chennai.India
'The other solution seems really great and simple.
'Here you havee an example of another way:
'this is a starting point for your operations
'you may do better, ie with reading in binary format...
option Explicit
'a reference to Microsoft activex 2.0 (or higher) object library
private cnn as ADODB.Connection
private Sub Command1_Click()
Dim allFileText, textVar
Dim strConn as string
Dim strSql as string
'your path to and name of page html
Open "d:\Impe\CodeTips\Htm\myHtmPage.htm" for input as #1
Do While EOF(1) = false
Line input #1, textVar
allFileText = allFileText & vbCrLf & textVar
Loop
Close #1
'coonection string: you will have to provide yours
strConn = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=false;Data Source=D:\Impe\CodeTips\Htm\mydb1.mdb"
'this is a non acceptable char "|" so substitute it with "~"
'while reading from db, remember to convert all "~" in "|" back
allFileText = Replace(allFileText, "|", "~")
'while reading/writing, you may find other chars not accepted...
'insert your page in a memo field odf a db with an ID field autoincrement
strSql = "Insert into Thtm (TextHtm) values (" & "'" & allFileText & "'" & ")"
set cnn = new ADODB.Connection
cnn.Open strConn
cnn.Execute (strSql)
cnn.Close
set cnn = nothing
End Sub
Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Micahel
and all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
The Rater
Thanx a lot its working good
Nitya