很简单的问题:我想从vb文件中读取数据,然后用aspx文件显视出来,求老大们帮我开导一下,解决这个例子!
ckxp 2003-05-16 01:37:32 Header.ascx文件内容:
<%@ Control inherits="ckxpHeader" src="header.ascx.vb" %>
<a href="我不知道这里应该怎么写在vb中的ckxpWebUrl" target="_blank"><img src="这里也不知道怎么写ckxpWebLogo" alt="这里是ckxpWebName" width="163" height="60" border="0"></a>
Header.ascx.vb文件内容:
Imports System
Imports System.Configuration
Imports System.Collections
Imports Microsoft.VisualBasic
Imports System.IO
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Data
Imports System.Data.Oledb
Public Class ckxpHeader : Inherits UserControl
Public ckxpWebName as String '这里我试过用label的方法调用,但提示出错了。
Public ckxpWebURL as String
Public ckxpWebLogo as String
Public Sub Page_Load(Sender as object,E as EventArgs)
Dim strConnection as string
strConnection="Provider=Microsoft.jet.oledb.4.0;Data Source=" & Server.MapPath("Date\ckxpDate.mdb")
Dim strSQL as string
strSQL="SELECT ckxpWebName,ckxpWebURL,ckxpWebLogo,ckxpWebBanner FROM ckxpWeb_Config"
Dim myConnection as New OledbConnection(strConnection)
Dim myCmd as New OledbCommand(strSQL,myConnection)
Dim myDR as OledbDataReader
myConnection.open
myDR=myCmd.ExecuteReader()
if myDR.read()
ckxpWebName=myDR("ckxpWebName")
ckxpWebURL=Server.UrlDecode(myDR("ckxpWebURL"))
ckxpWebLogo=Server.UrlDecode(myDR("ckxpWebLogo"))
end if
myDR.close
myConnection.close
End Sub
End Class