
April 7th, 2006, 05:58 PM
|
|
Registered User
|
|
Join Date: Apr 2006
Posts: 1
Time spent in forums: 16 m 19 sec
Reputation Power: 0
|
|
|
Problems with web matrix and my code.
Hey all, I'm using webmatrix (its basically an editor, with a built in webserver) to preview my asp.net, i'm just trying to get some data from a database and format it in such a way, a datagrid is not used. I'm pretty new to asp.net and ive been playing with some sample code, which i had to convert to use OLEDB, because im using a local access database.. when I try to interpret my code, I get this error.. I have no idea how about to about repairing it, I have pasted my code after the error, the error seems to be with MyCommand.Fill(DS, "story"), I have no idea how to fix it, any help would be useful
Quote: Server Error in '/' Application.
Could not load file or assembly 'System.EnterpriseServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.IO.FileNotFoundException: Could not load file or assembly 'System.EnterpriseServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
Source Error:
Line 22:
Line 23: DS = New DataSet()
Line 24: MyCommand.Fill(DS, "story")
Line 25:
Line 26: MyRepeater.DataSource = DS.Tables("Story").DefaultView
Source File: C:\Documents and Settings\gizm0\My Documents\web applications\viewstorys.aspx Line: 24 |
Code:
<%@ Page Language="VB" Debug="true" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.OleDb" %>
<script runat="server">
Sub Page_Load(Sender As Object, E As EventArgs)
Dim DS As DataSet
Dim MyConnection As OleDbConnection
Dim MyCommand As OleDbDataAdapter
Dim thequery As String = "SELECT [Story].[PostedBy], [Story].[Title], [Story].[PostTime], [Story].[Descript"& _
"ion], [Story].[PostDate], [Story].[StoryID], [Story].[Link], [Story].[Karma], [S"& _
"tory].[NumComments] FROM [Story]"
MyConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=karma.mdb")
MyCommand = New OleDbDataAdapter(thequery, myconnection)
DS = New DataSet()
MyCommand.Fill(DS, "story")
MyRepeater.DataSource = DS.Tables("Story").DefaultView
MyRepeater.DataBind()
End Sub
</script>
<html>
<head>
</head>
<body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0">
<ASP:Repeater id="MyRepeater" runat="server">
<HeaderTemplate>
<table width="100%" style="font: 8pt verdana">
<tr style="background-color:DFA894">
<th>
header
</th>
<th>
header
</th>
<th>
header
</th>
<th>
header
</th>
<th>
header
</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr style="background-color:FFECD8">
<td>
<%# DataBinder.Eval(Container.DataItem, "storyid") %>
</td>
<td>
<%# DataBinder.Eval(Container.DataItem, "title") %>
</td>
<td>
<%# DataBinder.Eval(Container.DataItem, "karma") %>
</td>
<td>
<%# DataBinder.Eval(Container.DataItem, "description") %>
</td>
<td>
<%# DataBinder.Eval(Container.DataItem, "link") %>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</ASP:Repeater>
</body>
</html>
thanks darkfire
|