vb2005接及SQL法
我在是自VB2005但是,很多方式都VB6.0不一,像接,用SQL法,都不一
望各位大示例
[解决办法]
接,有ADO,OLEDB,baidu一下就有很多了。至于SQL语法,就是看是什么数据库,语法基本上都相同
[解决办法]
建议查看MSDN,装上vs2005的时候,装上产品文档(MSDN)
[解决办法]
- C# code
SqlConnection thisConnection = new SqlConnection(@"Server = (local);Integrated Security = true;database = northwind"); SqlDataAdapter thisAdapter = new SqlDataAdapter( "SELECT CustomerID , ContactName FROM Customers", thisConnection); DataSet thisDataSet = new DataSet(); thisAdapter.Fill(thisDataSet, "Customers"); foreach (DataRow theRow in thisDataSet.Tables["Customers"].Rows) { Console.WriteLine(theRow["CustomerID"] + "\t" + theRow["ContactName"]); } thisConnection.Close(); Console.ReadLine();
[解决办法]
[解决办法]