General Network Exception (SqlException) with typed dataset

  • Thread starter Thread starter Keith Patrick
  • Start date Start date
K

Keith Patrick

I've seen people have this issue before, but it has always been intermittent for folks. Mine isn't (some students do work, but several cause the exception every single time). What goes on is that I try to pull up data on a student, but when DbDataAdaptor.Fill is called, I get the exception. It's buried so deep, I can't figure out the cause. I'd even be happy with some nudge in the right direction on where to look, as it's just too deep in the system for me to figure out. Every single time I grab the same
Here's my code:
SqlConnection con = null;

StudentProfileDS _studentDS = new StudentProfileDS();

SqlDataAdapter da = null;

try

{

con = new SqlConnection(ObjectConnectString);

con.Open();

cmd.Connection = con;


da = new SqlDataAdapter();

da.SelectCommand = cmd;

da.TableMappings.Add("Table", "Detail");

da.TableMappings.Add("Table1", "EnrollmentHistory");

da.TableMappings.Add("Table2", "AtRiskHistory");

da.TableMappings.Add("Table3", "LEPHistory");

da.TableMappings.Add("Table4", "GradesHistory");

da.TableMappings.Add("Table5", "Attendance");

da.TableMappings.Add("Table6", "Schedule");

da.TableMappings.Add("Table7", "Stanford");

da.TableMappings.Add("Table8", "RPTE");

da.TableMappings.Add("Table9", "HFW");

da.Fill( _studentDS ); // Here's where the exception occurs

return _studentDS;

}

catch (Exception ex)

{

throw ex;

}

finally

{

con.Close();

con.Dispose();

con = null;

da.Dispose();

da = null;

}
 
Hi Keith,

It might have something to do with select statement or network connection to the server.
Does it happen every time?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com
I've seen people have this issue before, but it has always been intermittent for folks. Mine isn't (some students do work, but several cause the exception every single time). What goes on is that I try to pull up data on a student, but when DbDataAdaptor.Fill is called, I get the exception. It's buried so deep, I can't figure out the cause. I'd even be happy with some nudge in the right direction on where to look, as it's just too deep in the system for me to figure out. Every single time I grab the same
Here's my code:
SqlConnection con = null;

StudentProfileDS _studentDS = new StudentProfileDS();

SqlDataAdapter da = null;

try

{

con = new SqlConnection(ObjectConnectString);

con.Open();

cmd.Connection = con;


da = new SqlDataAdapter();

da.SelectCommand = cmd;

da.TableMappings.Add("Table", "Detail");

da.TableMappings.Add("Table1", "EnrollmentHistory");

da.TableMappings.Add("Table2", "AtRiskHistory");

da.TableMappings.Add("Table3", "LEPHistory");

da.TableMappings.Add("Table4", "GradesHistory");

da.TableMappings.Add("Table5", "Attendance");

da.TableMappings.Add("Table6", "Schedule");

da.TableMappings.Add("Table7", "Stanford");

da.TableMappings.Add("Table8", "RPTE");

da.TableMappings.Add("Table9", "HFW");

da.Fill( _studentDS ); // Here's where the exception occurs

return _studentDS;

}

catch (Exception ex)

{

throw ex;

}

finally

{

con.Close();

con.Dispose();

con = null;

da.Dispose();

da = null;

}
 
It happens with certain students every time, but with other students, it never happens. The query itself runs fine in Query Analyzer, and if I call ExecuteReader on the SqlCommand instead of Fill, it also works without problem. What's killing me is that it would seem to be something with regards to the data I get back, but it is so deep in the framework, that I can't figure it out. I'm gonna dig around the IL to that method...maybe I can decode where that throw is at...but outside that, I just don't know what else to try.
"Miha Markic [MVP C#]" <miha at rthand com> wrote in message Hi Keith,

It might have something to do with select statement or network connection to the server.
Does it happen every time?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com
I've seen people have this issue before, but it has always been intermittent for folks. Mine isn't (some students do work, but several cause the exception every single time). What goes on is that I try to pull up data on a student, but when DbDataAdaptor.Fill is called, I get the exception. It's buried so deep, I can't figure out the cause. I'd even be happy with some nudge in the right direction on where to look, as it's just too deep in the system for me to figure out. Every single time I grab the same
Here's my code:
SqlConnection con = null;

StudentProfileDS _studentDS = new StudentProfileDS();

SqlDataAdapter da = null;

try

{

con = new SqlConnection(ObjectConnectString);

con.Open();

cmd.Connection = con;


da = new SqlDataAdapter();

da.SelectCommand = cmd;

da.TableMappings.Add("Table", "Detail");

da.TableMappings.Add("Table1", "EnrollmentHistory");

da.TableMappings.Add("Table2", "AtRiskHistory");

da.TableMappings.Add("Table3", "LEPHistory");

da.TableMappings.Add("Table4", "GradesHistory");

da.TableMappings.Add("Table5", "Attendance");

da.TableMappings.Add("Table6", "Schedule");

da.TableMappings.Add("Table7", "Stanford");

da.TableMappings.Add("Table8", "RPTE");

da.TableMappings.Add("Table9", "HFW");

da.Fill( _studentDS ); // Here's where the exception occurs

return _studentDS;

}

catch (Exception ex)

{

throw ex;

}

finally

{

con.Close();

con.Dispose();

con = null;

da.Dispose();

da = null;

}
 
Hi Keith,

It seems to me like a network problem (nothing to do with .net) which happens occasionaly.
What if you run app on the server?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com
It happens with certain students every time, but with other students, it never happens. The query itself runs fine in Query Analyzer, and if I call ExecuteReader on the SqlCommand instead of Fill, it also works without problem. What's killing me is that it would seem to be something with regards to the data I get back, but it is so deep in the framework, that I can't figure it out. I'm gonna dig around the IL to that method...maybe I can decode where that throw is at...but outside that, I just don't know what else to try.
"Miha Markic [MVP C#]" <miha at rthand com> wrote in message Hi Keith,

It might have something to do with select statement or network connection to the server.
Does it happen every time?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com
I've seen people have this issue before, but it has always been intermittent for folks. Mine isn't (some students do work, but several cause the exception every single time). What goes on is that I try to pull up data on a student, but when DbDataAdaptor.Fill is called, I get the exception. It's buried so deep, I can't figure out the cause. I'd even be happy with some nudge in the right direction on where to look, as it's just too deep in the system for me to figure out. Every single time I grab the same
Here's my code:
SqlConnection con = null;

StudentProfileDS _studentDS = new StudentProfileDS();

SqlDataAdapter da = null;

try

{

con = new SqlConnection(ObjectConnectString);

con.Open();

cmd.Connection = con;


da = new SqlDataAdapter();

da.SelectCommand = cmd;

da.TableMappings.Add("Table", "Detail");

da.TableMappings.Add("Table1", "EnrollmentHistory");

da.TableMappings.Add("Table2", "AtRiskHistory");

da.TableMappings.Add("Table3", "LEPHistory");

da.TableMappings.Add("Table4", "GradesHistory");

da.TableMappings.Add("Table5", "Attendance");

da.TableMappings.Add("Table6", "Schedule");

da.TableMappings.Add("Table7", "Stanford");

da.TableMappings.Add("Table8", "RPTE");

da.TableMappings.Add("Table9", "HFW");

da.Fill( _studentDS ); // Here's where the exception occurs

return _studentDS;

}

catch (Exception ex)

{

throw ex;

}

finally

{

con.Close();

con.Dispose();

con = null;

da.Dispose();

da = null;

}
 
It still breaks on the server, but our DB server is on a different machine
than the app server. Also, if I use my local machine as the app server,
same result (it happens in debug and release builds). I've gone over to a
development DB instead of our staging one, and it's working, but the procs
that are called are slightly different, as is the data, so I'm currently
diff'ing things between environments. I'll post when/if I find something.

Is there any reason that a large amount of data coming back would break the
..Fill method? The reason I ask is that a simple execution of the proc from
the app works fine; it's only when the .Fill method is called that it breaks
(with or without the table mappings)
"Miha Markic [MVP C#]" <miha at rthand com> wrote in message
Hi Keith,

It seems to me like a network problem (nothing to do with .net) which
happens occasionaly.
What if you run app on the server?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com
It happens with certain students every time, but with other students, it
never happens. The query itself runs fine in Query Analyzer, and if I call
ExecuteReader on the SqlCommand instead of Fill, it also works without
problem. What's killing me is that it would seem to be something with
regards to the data I get back, but it is so deep in the framework, that I
can't figure it out. I'm gonna dig around the IL to that method...maybe I
can decode where that throw is at...but outside that, I just don't know what
else to try.
"Miha Markic [MVP C#]" <miha at rthand com> wrote in message
Hi Keith,

It might have something to do with select statement or network connection to
the server.
Does it happen every time?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com
I've seen people have this issue before, but it has always been intermittent
for folks. Mine isn't (some students do work, but several cause the
exception every single time). What goes on is that I try to pull up data on
a student, but when DbDataAdaptor.Fill is called, I get the exception. It's
buried so deep, I can't figure out the cause. I'd even be happy with some
nudge in the right direction on where to look, as it's just too deep in the
system for me to figure out. Every single time I grab the same
Here's my code:
SqlConnection con = null;
StudentProfileDS _studentDS = new StudentProfileDS();
SqlDataAdapter da = null;
try
{
con = new SqlConnection(ObjectConnectString);
con.Open();
cmd.Connection = con;
da = new SqlDataAdapter();
da.SelectCommand = cmd;
da.TableMappings.Add("Table", "Detail");
da.TableMappings.Add("Table1", "EnrollmentHistory");
da.TableMappings.Add("Table2", "AtRiskHistory");
da.TableMappings.Add("Table3", "LEPHistory");
da.TableMappings.Add("Table4", "GradesHistory");
da.TableMappings.Add("Table5", "Attendance");
da.TableMappings.Add("Table6", "Schedule");
da.TableMappings.Add("Table7", "Stanford");
da.TableMappings.Add("Table8", "RPTE");
da.TableMappings.Add("Table9", "HFW");
da.Fill( _studentDS ); // Here's where the exception occurs
return _studentDS;
}
catch (Exception ex)
{
throw ex;
}
finally
{
con.Close();
con.Dispose();
con = null;
da.Dispose();
da = null;
}
 
I copied the version of the proc on the "bad" server over to the good one,
and it still worked OK on that DB. There are an extra 3 rows of data on the
"bad" server, but I can't see it as enough to cause a problem like that.
But if it's a network issue, what kind would it be where certain students
come back fine whereas others consistently get that error? BTW: My PM just
told me that the same issue is out in our production environment, but with
different students (my test case doesn't break on prod, but other students
always do over there)
"Miha Markic [MVP C#]" <miha at rthand com> wrote in message
Hi Keith,

It seems to me like a network problem (nothing to do with .net) which
happens occasionaly.
What if you run app on the server?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com
It happens with certain students every time, but with other students, it
never happens. The query itself runs fine in Query Analyzer, and if I call
ExecuteReader on the SqlCommand instead of Fill, it also works without
problem. What's killing me is that it would seem to be something with
regards to the data I get back, but it is so deep in the framework, that I
can't figure it out. I'm gonna dig around the IL to that method...maybe I
can decode where that throw is at...but outside that, I just don't know what
else to try.
"Miha Markic [MVP C#]" <miha at rthand com> wrote in message
Hi Keith,

It might have something to do with select statement or network connection to
the server.
Does it happen every time?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com
I've seen people have this issue before, but it has always been intermittent
for folks. Mine isn't (some students do work, but several cause the
exception every single time). What goes on is that I try to pull up data on
a student, but when DbDataAdaptor.Fill is called, I get the exception. It's
buried so deep, I can't figure out the cause. I'd even be happy with some
nudge in the right direction on where to look, as it's just too deep in the
system for me to figure out. Every single time I grab the same
Here's my code:
SqlConnection con = null;
StudentProfileDS _studentDS = new StudentProfileDS();
SqlDataAdapter da = null;
try
{
con = new SqlConnection(ObjectConnectString);
con.Open();
cmd.Connection = con;
da = new SqlDataAdapter();
da.SelectCommand = cmd;
da.TableMappings.Add("Table", "Detail");
da.TableMappings.Add("Table1", "EnrollmentHistory");
da.TableMappings.Add("Table2", "AtRiskHistory");
da.TableMappings.Add("Table3", "LEPHistory");
da.TableMappings.Add("Table4", "GradesHistory");
da.TableMappings.Add("Table5", "Attendance");
da.TableMappings.Add("Table6", "Schedule");
da.TableMappings.Add("Table7", "Stanford");
da.TableMappings.Add("Table8", "RPTE");
da.TableMappings.Add("Table9", "HFW");
da.Fill( _studentDS ); // Here's where the exception occurs
return _studentDS;
}
catch (Exception ex)
{
throw ex;
}
finally
{
con.Close();
con.Dispose();
con = null;
da.Dispose();
da = null;
}
 
Keith Patrick said:
It still breaks on the server, but our DB server is on a different machine
than the app server. Also, if I use my local machine as the app server,
same result (it happens in debug and release builds). I've gone over to a
development DB instead of our staging one, and it's working, but the procs
that are called are slightly different, as is the data, so I'm currently
diff'ing things between environments. I'll post when/if I find something.

Is there any reason that a large amount of data coming back would break
the .Fill method? The reason I ask is that a simple execution of the proc
from the app works fine; it's only when the .Fill method is called that it
breaks (with or without the table mappings)

Hi Keith,

The difference between execute and Fill is, that execute doesn't fetch any
data until you request it, while Fill does fetch all available data (thus
doint network transfer).
 
UPDATE: I've isolated the problem to a data issue, as our DBA xferred
production data over to the problem server, and everything works fine again,
although I'm awaiting some validation on whether some problem records in
production are now migrated as well, which would effectively remove the
physical network from the problem, unless the network somehow detects
invalid data as a security violation.
 
Back
Top