Exception information for "Internal connection fatal error." what went wrong, should be how to modify? If the connection string to write it?
Using Microsoft. The Data. SqlClient.
using System;
The namespace SqlDatabase
{
Class Program
{
The static void Main (string [] args)
{
Console. WriteLine (" Hello World!" );
String SqlCon="integrated security=SSPI; Data source='(local);='StarsData' initial catalog ";
//SqlCon="uid='sa'. The PWD='111'. Data source='(local);='StarsData' initial catalog ";
SqlConnection SCN=new SqlConnection ();
Try
{
SCN. The ConnectionString=SqlCon;
SCN. The Open ();
SqlCommand SCD=new SqlCommand ();
SCD. Connection=SCN;
Scd.Com mandText="select ObjectName from dbo. DeepSkyObject where Type='N'";
SqlDataReader SDR=SCD. ExecuteReader ();
While (SDR) Read ())
{
Console. WriteLine (" celestial: "+ SDR. Get string (0));
}
}
The catch (Exception e)
{
Console. WriteLine (e.M essage);
}
The finally
{
If (SCN.=null)
{
SCN. The Close ();
}
}
}
}
}