急请教一个ASP.NET and MySQL 的问题我安装了ODBC data provider
可是when i use
using Microsoft.Data.Odbc;
还是说 The type or namespace name 'Data' does not exist in the class or namespace 'Microsoft' (are you missing an assembly reference?)
芬特死了
一上午了
那位帮忙看看?
谢谢~~~[MrDJay (7-26 10:48, Long long ago)]
[ 传统版 |
sForum ][登录后回复]1楼
无语了....应该用 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();
}
[SmellsLikeTeenSpirit (7-26 10:53, Long long ago)]
[ 传统版 |
sForum ][登录后回复]2楼
(引用 SmellsLikeTeenSpirit:无语了....应该用 using System.Data.Odbc
这里贴code会remove whitespace, 看起来比较麻烦. 你可以参考.NET Framewkrok SDK Documentat...)so ft............all online reference I get is telling me
should using Microsoft.Data.Odbc;
eg
http://www.mysql.com/articles/dotnet/#ADO.NET
so ft.......[MrDJay (7-26 11:06, Long long ago)]
[ 传统版 |
sForum ][登录后回复]3楼
(引用 MrDJay:so ft............all online reference I get is telling me should using Microsoft.Data.Odbc; eg http://www.mysql.com/articles)i c. let's talk about this later[SmellsLikeTeenSpirit (7-26 11:10, Long long ago)] [ 传统版 | sForum ][登录后回复]4楼
是应该用Microsoft.Data.Odbc的我试过,可以的.你把Microsoft.Data.Odbc加入References再试试...[ross (7-27 11:01, Long long ago)] [ 传统版 | sForum ][登录后回复]5楼