SQLClient (was: AW: [Mono-devel-list] (Mono) ASP.NET DataBindung, and apache mod_mono)
Krieg Andreas
Krieg.Andreas at OCE.DE
Fri Jun 13 05:58:30 EDT 2003
I made some tests with DataBinding and empty lists/hand made DataTables,
works fine.
Seems to be some sql stuff it happens with the following code:
<%@ Page Language="C#" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SqlClient" %>
<script runat="server">
public DataSet GetDBEvents() {
// Create Instance of Connection and Command Object
SqlConnection myConnection = new
SqlConnection("server=localhost;user id=sa;password=pw;database=Portal");
SqlDataAdapter myAdapter = new SqlDataAdapter();
SqlCommand myCommand = new SqlCommand("Select * from Events where
ModuleID=38", myConnection);
myCommand.CommandType = CommandType.Text;
myConnection.Open();
DataSet myDataSet = new DataSet();
myAdapter.SelectCommand = myCommand;
myAdapter.Fill(myDataSet);
myConnection.Close();
// Return the DataSet
return myDataSet;
}
void Page_Load(Object sender, EventArgs e) {
myDataList.DataSource = GetDBEvents();
myDataList.DataBind();
}
</script>
<html>
<head>
</head>
<body>
<h1>Upcoming Events</h2>
<form runat="server">
<asp:DataList id="myDataList" runat="server" EnableViewState="false"
Width="98%" CellPadding="4">
<ItemTemplate>
<asp:Label Text='<%#
DataBinder.Eval(Container.DataItem,"Title") %>' runat="server" />
</span>
<br />
<span class="Normal"> <i> <%#
DataBinder.Eval(Container.DataItem,"WhereWhen") %> </i> </span>
<br />
<span class="Normal"> <%#
DataBinder.Eval(Container.DataItem,"Description") %> </span>
<br />
</ItemTemplate>
</asp:DataList>
<!-- Insert content here -->
</form>
</body>
</html>
Seems that the SqlAdapter doesn't fill any information into the Dataset if
the Events table has now Datarows, then I get the Exception.
Don't know if it is the same with other Databases....
Ok, if there are no comments I'll prepare more documents for a bug
report....
Regards
Andreas
-----Ursprüngliche Nachricht-----
Von: Gonzalo Paniagua Javier [mailto:gonzalo at ximian.com]
Gesendet: Donnerstag, 12. Juni 2003 18:54
An: 'mono-devel-list at lists.ximian.com'
Betreff: Re: [Mono-devel-list] (Mono) ASP.NET DataBindung, and apache
mod_mono
El jue, 12-06-2003 a las 17:19, Krieg Andreas escribió:
>
> And the following warning:
>
> (/u/home/kriegand/mono/install/bin/mcs.exe:17708): WARNING **: cant
> resolve internal call to
> "Apache.Web.Request::SetStatusLineInternal(intptr,string)"
> (tested without signature also)
Don't worry about that warning.
>
> What is out of sync? I built fresh from cvs with the build script and
> rebuild the class library....
>
> However, the ModMono.dll will be createt but if I go through apache
> and go to the mono tests that I used the following error appears:
>
> Error
> Description: Error processing request.
> Error Message: String returned by
> HttpRuntime.GetResourceStringFromResourceManager
> Stack Trace:
> System.Web.HttpException: String returned by
> HttpRuntime.GetResourceStringFromResourceManager
> in <0x0008e> 00 System.Web.HttpApplication:InitModules ()
> Ok I know in the FAQ there is something about that, seems that the
> machine.config can not be found, but I paced it in the install/etc, in
> /etc/mono and /usr/etc/mono and I created the ModMono.exe.config in my
> directory where the aspx pages are, but no success, any idea?
You must install that file in $PREFIX/etc/mono. It's in
mono/data/machine.config in CVS.
>
>
> The next GENERAL problem I have is the databinding of controls. For
> example the IBuySpy Portal has an event modul that reads the Events
> from a DataBase, the returned collection is a DataSet that will be
> bound to a DataGrid or Repeater or whatever, when there are no
> datasets I get the same error like the error from mod_mono:
>
> Error
> Description: Error processing request.
> Error Message: String returned by
> HttpRuntime.GetResourceStringFromResourceManager
> Stack Trace:....
>
> I found out that the function GetResolvedDataSource() from
> System.Web.Util throws an exception when there are no members in the
> DataSet, in line 56/57:
>
> throw new
> HttpException(HttpRuntime.FormatResourceString("ListSource_Without_Dat
> aMembe
> rs"));
>
> I think this is fatal, the MS ASP.NET stuff for example displays only
> the header of the DataTable that it was bound to, if there are no
> Members in the DataTable or the IEnumerable class that the control is
> bound to.....
>
>
> Is this a bug or what can I do??
This may be a bug. Please, fill a bug report attaching a small test case to
reproduce it.
-Gonzalo
_______________________________________________
Mono-devel-list mailing list
Mono-devel-list at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list
More information about the Mono-devel-list
mailing list