代码如下:
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返回的记录有很多条的。各位大哥帮忙看下。
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返回的记录有很多条的。各位大哥帮忙看下。
如:SELECT * FROM page 都没反应
你的objcon 有没有 Open啊?
后台编码,数据无法显示。
http://topic.csdn.net/t/20030513/15/1777619.html
前台没写<itemcolumn> 以为和datagrid一样了