Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"Internal connection fatal error" message running SQL

Status
Not open for further replies.

StevenK

Programmer
Jan 5, 2001
1,294
GB
When I run an SQL statement via SQL Query Analyzer I get no issues with an SQL statement - however when I run the same via code written in c-sharp I get the error :
"Internal connection fatal error".

All other SQL statements run successfully through code - it's just this one and it's a simple one at that:

SELECT [PLMN], [PLDescription]
FROM [Purchase Ledger]
WHERE [PLDescription] IS NOT NULL
ORDER BY [PLDescription]

Can anyone suggest why this one SQL would give us an issue?
Any help would be appreciated.
Thanks in advance.
Steve
 
Can we see the code where you connect to the database, execute that statement, etc?

----------------------------------------

TWljcm8kb2Z0J3MgIzEgRmFuIQ==
 
Are you using named pipes for transport instead of standard TCP ? Named pipes are so unreliable... [ponder] It might help to change the protocol order, take a look here
Or maybe a faulty network connection... basically that error means that the connection broke mid-stream...
 
Here is the method code as a whole:

private void LoadPurchaseLedgerList()
{
SqlCommand cmd = new SqlCommand();
SqlDataAdapter da = new SqlDataAdapter();
DataTable dt = new DataTable();
try
{
cbPLAccount.Items.Clear();
string selStr = @"SELECT [PLMN], [PLDescription]
FROM [Purchase Ledger]
WHERE [PLDescription] IS NOT NULL
ORDER BY [PLDescription]";
cmd = new SqlCommand(selStr, sc);
cmd.CommandType = CommandType.Text;
cmd.Parameters.Clear();
da = new SqlDataAdapter(cmd);
da.Fill(dt);
for (int i = 0; i < dt.Rows.Count; i++)
{
DataRow dr = dt.Rows;
cbPLAccount.Items.Add(dr["PLDescription"].ToString() + " [" + dr["PLMN"].ToString() + "]");
}
cbPLAccount.SelectedIndex = 0;
}
catch (SqlException sqex)
{
MessageBox.Show(@"Sql Failure. Unable to load PL Account List." + "\n\n" + sqex.Message);
return;
}
catch (Exception ex)
{
MessageBox.Show(@"General Failure. Unable to load PL Account List." + "\n\n" + ex.Message);
return;
}
finally
{
dt.Dispose();
da.Dispose();
cmd.Dispose();
}
}

This code runs in the same way (and uses the same SqlConnection object - 'sc') as the equivalent method that retrieves the Sales Ledger information - which runs without error.

Can anyone shed any further clues on this please?
Thanks in advance.
Steve
 
Furthermore - this table does not contain a vast number of records - only about 200 entries - so it's not that the connection / machine is running out of steam ... :-(

I'm at a loss ....

I'm running against a local copy of the database - so there should not be any issues with connections / network.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top