DS问题,,那里错了,'System.Data.DataTableCollection' 弄了半天都没有解决
下面的代码的意思,就是用DS读出数据,然后写到 <asp:Label>上
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>]
<Script Language="VB" Runat="Server">
'BindList 过程用来指定数据源,并连接到 DataGrid 控件
Sub Page_Load(sender As Object, e As Eventargs)
dim id As Integer
id=request.QueryString("id")
'response.write (id)
'response.end
Dim strSQL As String = "Select * From enet_news where id="&id
Dim ConnString As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath("data_net/data.mdb")
Dim objCmd As New OleDbDataAdapter(strSQL, ConnString)
Dim DS As New DataSet()
objCmd.Fill(DS,"enet_news")
'Dim myTable As DataTable=DS.Tables("enet_news")
if DS.Tables[0].Rows.Count==1 then
news_title.text=DS.Tables[0].Columns[0].ToString();
end if
End Sub
</Script>
------------------------
老是提示DS不成功,什么原因呢
编译错误
说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。
编译器错误信息: BC30311: Value of type 'System.Data.DataTableCollection' cannot be converted to 'Boolean'.
源错误:
行 20: objCmd.Fill(DS,"enet_news")
行 21: 'Dim myTable As DataTable=DS.Tables("enet_news")
行 22: if DS.Tables[0].Rows.Count==1 then
行 23: news_title.text=DS.Tables[0].Columns[0].ToString();
源文件: F:\ASP_NET\enet_news\show_news.aspx 行: 22