声明了连接么
SqlConnection cnn = new SqlConnection(ConnectionString);
cnn.Open();声明了DataSet么
DataSet dsNode = new DataSet();
SqlConnection cnn = new SqlConnection(ConnectionString);
cnn.Open();声明了DataSet么
DataSet dsNode = new DataSet();
解决方案 »
- datagridview 中的checkbox列,如果行数太多,如何更快的默认的全选
- 多表查询的例子
- 上位机软件开发模式和一个小问题.
- 读取Excel数据??
- 请问如何把C#代码生成il的中间语言代码
- winfrom做的程序如何自适应 4:3 16:9的显示器? (C#)
- 如何将C#数组(如bytes[])传给具有IntPtr的托管代码函数?
- 在IE中嵌入Windows控件这样做程序,有什么局限性?
- 在c#中如何动态的去调用DLL文件?
- C++怎么得到文件后缀名
- 如果对方封了端口137/138/139,也就是不能通过\\ip的方式访问对方共享文件.这对我使用对方机子上的sqlserver(1433)没影响吧?
- 请问一下大家怎么在datagrid中移动行的光标,用函数
string strSql ="SELECT OrderID, CustomerID FROM Orders"
SqlConnection con = new SqlConnection(ConnectionString);
con.Open();
DataSet dsNode = new DataSet();
SqlDataAdapter adTemp;
adTemp = new SqlDataAdapter(strSql, con);
adTemp.Fill(dsNode,"dsNode");
添加了
连接con声明
DataSet dsNode声明
应该没问题了
string strSql ="SELECT IsNull(Cast(OrderID as Varchar(50)),'') as OrderID , IsNull(Cast(CustomerID as Varchar(10)),'') as CustomerID FROM Orders"
SqlConnection con = new SqlConnection(ConnectionString);
con.Open();
DataSet dsNode = new DataSet();
SqlDataAdapter adTemp = new SqlDataAdapter(strSql, con);
adTemp.Fill(dsNode,"dsNode");请比较一下。
string ConnectionString="workstation id=IKNOW;packet size=4096;user id=sa;initial catalog=Northwind;persist security info=False";
string strSql ="SELECT OrderID, CustomerID FROM Orders"
SqlConnection con = new SqlConnection(ConnectionString);
con.Open();
DataSet dsNode = new DataSet(); /*报错说:未处理的“System.Data.SqlClient.SqlException”类型的异常出现在 system.data.dll 中。其他信息: 系统错误。*/
SqlDataAdapter adTemp;
adTemp = new SqlDataAdapter(strSql, con);
adTemp.Fill(dsNode,"dsNode");
SqlConnection nwindConn = new SqlConnection("Data Source=localhost;Integrated Security=SSPI;Initial Catalog=northwind");SqlCommand selectCMD = new SqlCommand("SELECT CustomerID, CompanyName FROM Customers", nwindConn);
selectCMD.CommandTimeout = 30;SqlDataAdapter custDA = new SqlDataAdapter();
custDA.SelectCommand = selectCMD;nwindConn.Open();DataSet custDS = new DataSet();
custDA.Fill(custDS, "Customers");nwindConn.Close();