The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

mhildebrand (1) [Avatar] Offline
#1
Hello everyone...

Just finished your book Fergal. I often wonder how someone can provide such a knowledgable book, without having a book himself to read! Great book!

For the life of me, I can not get the example in chapter 8 on 'dataform.aspx' to work. I'm positive the problem is NOT the SQL connection string, because to works in all other examples. I'm using ASP.NET 1.1, and I even tried, and moved back to ASP.NET 1.0, still it still bombs.

The error I get is 'General network error. Check your network documentation' and it is on "Line 20: com.Fill(ds, "games");"

Here's the cut/paste of accessing... (it looks so straight-forward!)

<!-- dataform.aspx -->

<%@ Page Language="C#" debug="true"%>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>

<script runat="server">

protected override void OnLoad(EventArgs e) {

base.OnLoad(e);

SqlConnection con = new SqlConnection("server=192.168.163.125;database=poker;trusted_connection=yes");

SqlDataAdapter com =
new SqlDataAdapter("select * from games", con);

DataSet ds = new DataSet();
com.Fill(ds, "games");

gamesGrid.DataSource=ds.Tables["games"].DefaultView;
gamesGrid.DataBind();
}
</script>

<html><head><title>DataGrid ASP.NET App</title></head>
<body>
<h1>DataGrid ASP.NET Application</h1>
<form runat="server">
<asp:dataGrid >
id="gamesGrid"
BackColor="Gainsboro"
BorderColor="black"
CellPadding="10"
CellSpacing="0"
Font-Name="Verdana"
Font-Size="8pt"
Font-Bold="true"
HeaderStyle-BackColor="lightGreen"
EnableViewState="false"
runat="server" />
</form>
</body>
</html>