读书人

vb2005接及SQL法解决办法

发布时间: 2012-03-06 20:47:55 作者: rapoo

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();
[解决办法]
探讨
最好用ado.net
因为你连sql2000
所以推荐用system.Data.SqlClient命名空间

[解决办法]
探讨
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");


读书人网 >VB Dotnet

热点推荐