c# 连接ORACLE 数据库进行查询,报“算术运算导致溢出”错误
代码如下。。。。class DBConnect
{
public DBConnect()
{
}
public void conntest()
{
OdbcConnection conn = new OdbcConnection("DSN=CenterDB;UID=xxxx;Pwd=123456;");
OdbcCommand catCMD = conn.CreateCommand();
catCMD.CommandText = "select site_no,site_name from TSM_SITE";
conn.Open();
OdbcDataReader myReader = catCMD.ExecuteReader();
while (myReader.Read())
{
Console.WriteLine("{0} {1}", myReader.GetString(0),myReader.GetString(1));
}
myReader.Close();
conn.Close();
}
}
site_no在数据库里面的类型是VARCHAR2(20)
site_name 是VARCHAR2(164)
程序运行在OdbcDataReader myReader = catCMD.ExecuteReader();这句报“算术运算导致溢出”错误。
各位大神。。。。这是咋回事啊。。。。 c# RACLE Oracle C# --------------------编程问答-------------------- 木有人鸟我。。。。顶。。。。 --------------------编程问答-------------------- OdbcConnection 这个用的不对用OracleConnection --------------------编程问答-------------------- Oracle数据库用 OdbcConnection 或者OLEDBConnection来连接数据库 --------------------编程问答--------------------
不能用ODBC? --------------------编程问答-------------------- 貌似不行,用OracleConnection 和OLEDBConnection --------------------编程问答-------------------- 仅供参考
OleDbConnection conn = new OleDbConnection("Provider=MSDAORA.1;Data Source=(DESCRIPTION =(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.234)(PORT = 1521)))(CONNECT_DATA = (SID = orcl))) ;User Id=sjk;Password=sssss");
conn.Open();
string sql = "select * from tbl_aa ";
OleDbDataAdapter da = new OleDbDataAdapter(sql, conn);
DataSet ds = new DataSet();
da.Fill(ds, "ds");
dataGridView1.DataSource = ds.Tables[0];
补充:.NET技术 , C#