无语了....
所在版块:社会百科 发贴时间:2003-07-26 10:53

用户信息
复制本帖HTML代码
高亮: 今天贴 X 昨天贴 X 前天贴 X 
应该用 using System.Data.Odbc

这里贴code会remove whitespace, 看起来比较麻烦. 你可以参考.NET Framewkrok SDK Documentation. 只要你的机器上装了.NET Framework, 就可以从"Start"里找到.


public void ReadMyData(string myConnString) {
string mySelectQuery = "SELECT OrderID, CustomerID FROM Orders";
OdbcConnection myConnection = new OdbcConnection(myConnString);
OdbcCommand myCommand = new OdbcCommand(mySelectQuery,myConnection);
myConnection.Open();
OdbcDataReader myReader;
myReader = myCommand.ExecuteReader();
// Always call Read before accessing data.
while (myReader.Read()) {
Console.WriteLine(myReader.GetInt32(0) + ", " + myReader.GetString(1));
}
// always call Close when done reading.
myReader.Close();
// Close the connection when done with it.
myConnection.Close();
}

.
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!

War is peace.
Freedom is slavery.
Ignorance is strength.
 相关帖子 我要回复↙ ↗回到正文
急请教一个ASP.NET and MySQL 的问题 MrDJay   (255 bytes , 348reads )
是应该用Microsoft.Data.Odbc的 ross   (60 bytes , 277reads )
无语了.... SmellsLikeTeenSpirit   (824 bytes , 256reads )
so ft............ MrDJay   (142 bytes , 236reads )
i c. let's talk about this later SmellsLikeTeenSpirit   (0 bytes , 164reads )