datalist无法显示数据。(无错误信息)
代码如下:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
If Not IsPostBack Then
Dim sqlstr As String = "SELECT id, title, content FROM page WHERE (pagecode = 1) "
Dim connstr As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\Documents and Settings\App_Data\page.mdb "
Dim objcon As New OleDbConnection(connstr)
Dim objdataset As New DataSet()
Dim objajapter As New OleDbDataAdapter(sqlstr, objcon)
Try
objajapter.Fill(objdataset, "code ")
Dim objDataView As New DataView(objdataset.Tables( "code "))
Datal.DataSource = objDataView
Datal.DataBind()
Catch objError As OleDbException
If Left(objError.Message, 21) = "Login failed for user " Then
ddc.Text = "Problem with Log-in "
ElseIf Left(objError.Message, 19) = "Could not find file " Then
ddc.Text = "We could not find the MDB file that you asked for "
Else
ddc.Text = " <br /> message - " & objError.Message
ddc.Text += " <br /> source - " & objError.Source
End If
End Try
End If
End Sub
没有显示错误,也没有显示数据,sql返回的记录有很多条的。各位大哥帮忙看下。
[解决办法]
好像问题在于后台编码。
我把代码和页面放在一起就可以显示,
把代码和页面分开写就不能显示。
怎么回事呢?
=================================
那就是后台代码没关联到了