有这样一个任务
  在access数据库中存放着新闻的标题和内容
  现在vb编一个程序
  要求这个程序能够做到从数据库中读取新闻的标题和内容
  并生成一个网页
  然后将网页保存到数据库中  请各位赐教

解决方案 »

  1.   

    //要求这个程序能够做到从数据库中读取新闻的标题和内容
    这个因该没有问题吧//并生成一个网页
    直接用写文件的方法
    Private Sub Command1_Click()
    Dim strsql As String
    Dim fs, f
    Set fs = CreateObject("scripting.filesystemobject")
    Set f = fs.CreateTextFile("c:\test.html", True)
    strsql = strsql & "<html>" & vbNewLine
    strsql = strsql & "<body>" & vbNewLine
    strsql = strsql & "<table>" & vbNewLine
    strsql = strsql & "<tr>" & vbNewLine
    '下面这句可以换成记录集
    strsql = strsql & "<td> " & Text1.Text & "  </td>" & vbNewLine
    strsql = strsql & "</tr>" & vbNewLine
    strsql = strsql & "</table>" & vbNewLine
    strsql = strsql & "</body>" & vbNewLine
    strsql = strsql & "</html>"
    f.write strsql
    f.Close
    End Sub//然后将网页保存到数据库中
    你可以把strsql保存,取出的时候生成
    或者生成网页后把路径存入数据库
      

  2.   

    conn.Execute "SELECT * INTO [HTML Export;DATABASE=C:\].[mz.HTM] FROM [mz]"
    或者这样
      

  3.   

    就是说标题和内容的位置和大小都是固定的生成html文件时用html中的标签控制,你可以先在dm中写好一个网页,然后把代码用vb写一下就可以了