C#winForm程序连接sqlserver2005,出现以上提示,咋回事?相关程序如下:stringSQL="select*fromEmployee";stringmyConStr="DataSource="+serverIP+"\\SQLEXPRESS;InitialCatalog=Fil...
C# winForm程序连接sql server2005,
出现以上提示,咋回事?
相关程序如下:
string SQL = "select * from Employee";
string myConStr = "Data Source=" + serverIP + "\\SQLEXPRESS;Initial Catalog=FilmManager;User ID=clwang;Persist Security Info=True";
SqlConnection myConnection = new SqlConnection(myConStr);
SqlDataAdapter myAdapter = new SqlDataAdapter(SQL,myConnection);
myAdapter.SelectCommand = new SqlCommand(SQL, myConnection);
try
{
myConnection.Open();
myAdapter.Fill(myDS);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
if (myConnection.State == ConnectionState.Open)
myConnection.Close();
}
应该不是程序的问题。
展开