“System.Data.SqlClient.SqlConnection”并不包含“open”的定义
相关的程序代买如下:stringstrcnn="DataSource=localhost;InitialCatalog=BookStore;UserID=osierswa...
相关的程序代买如下:
string strcnn = "Data Source=localhost; Initial Catalog=BookStore; User ID=osierswallow; Pwd=alizee; Connection TimeOut=30";
SqlConnection SqlCnn = new SqlConnection();
SqlCnn.ConnectionString = strcnn;
SqlCnn.open();
SqlCommand SqlCmd = SqlCnn.CreateCommand();
SqlCmd.CommandText = "select * from T_Publishers; select * from T_BookClass";
SqlDataReader SqlReader = SqlCmd.ExecuteReader();
int ncol = SqlReader.FieldCount;
谢谢!! 展开
string strcnn = "Data Source=localhost; Initial Catalog=BookStore; User ID=osierswallow; Pwd=alizee; Connection TimeOut=30";
SqlConnection SqlCnn = new SqlConnection();
SqlCnn.ConnectionString = strcnn;
SqlCnn.open();
SqlCommand SqlCmd = SqlCnn.CreateCommand();
SqlCmd.CommandText = "select * from T_Publishers; select * from T_BookClass";
SqlDataReader SqlReader = SqlCmd.ExecuteReader();
int ncol = SqlReader.FieldCount;
谢谢!! 展开
1个回答
展开全部
应该是 SqlCnn.Open();
不是 SqlCnn.open();
不是 SqlCnn.open();
参考资料: http://msdn.microsoft.com/zh-cn/library/system.data.sqlclient.sqlconnection(VS.80).aspx
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询