PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Hébergement serveur > comp.db.ms-sqlserver > SqlDataReader on Sql 2005
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
SqlDataReader on Sql 2005

Réponse
 
LinkBack Outils de la discussion
Vieux 17/11/2008, 23h29   #1
mastershake
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut SqlDataReader on Sql 2005

I'm trying to make some c#. I have a sqldatareader to get the logical
file names from *.BAK files. It works on the default instance but if I
add a named instance it fails. It gives me this:

System.Data.SqlClient.SqlException: A transport-level error has
occurred when sending the request to the server. (provider: TCP
Provider, error: 0 - An existing connection was forcibly closed by the
remote host.)

I don't get this error on the default instance. Any ideas what is
going on?

Here is my sqldatareader code part:

SqlConnection conn = new SqlConnection(getConnStr(instance));
conn.Open();
SqlCommand cmd = new SqlCommand(sql, conn);
SqlDataReader ln = cmd.ExecuteReader();
string logname = string.Empty;
while (ln.Read())
{
logname += ln[0].ToString() + ",";

}
ln.Close();

Any ideas what is happening?
  Réponse avec citation
Vieux 18/11/2008, 22h03   #2
Erland Sommarskog
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: SqlDataReader on Sql 2005

mastershake (akertis@gmail.com) writes:
> I'm trying to make some c#. I have a sqldatareader to get the logical
> file names from *.BAK files. It works on the default instance but if I
> add a named instance it fails. It gives me this:
>
> System.Data.SqlClient.SqlException: A transport-level error has
> occurred when sending the request to the server. (provider: TCP
> Provider, error: 0 - An existing connection was forcibly closed by the
> remote host.)
>
> I don't get this error on the default instance. Any ideas what is
> going on?


I'm a little uncertain how to interpret that message. My first reaction
was that it was a result of an internal error in SQL Server or SqlClient,
but maybe it's a network issue.

Could you try with replacing the command with something simple like
"SELECT 12"?
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinf...ons/books.mspx

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 02h25.


Édité par : vBulletin®
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,07786 seconds with 10 queries