string QuerySqlString = "SELECT DBA04.NCYL \"年产油量\" FROM DBA04 "; private void Form2_Load(object sender, EventArgs e) { this.dataGridView1.DataSource = OracleGetData(); this.dataGridView2.DataSource = DonetGetData(); } public DataTable DonetGetData() { DataTable dt = null; string strcon = "Data Source=orcl;User Id=kfzxca;Password=kfzxca;"; using (System.Data.OracleClient.OracleConnection con = new System.Data.OracleClient.OracleConnection(strcon)) { con.Open(); System.Data.OracleClient.OracleCommand cmd = con.CreateCommand(); cmd.CommandText = QuerySqlString; System.Data.OracleClient.OracleDataAdapter dap = new System.Data.OracleClient.OracleDataAdapter(); dap.SelectCommand = cmd; dt = new DataTable(); dap.Fill(dt); con.Close(); } return dt; } public DataTable OracleGetData() { DataTable dt = null; string strcon = "Data Source=orcl;User Id=kfzxca;Password=kfzxca;"; using (Oracle.DataAccess.Client.OracleConnection con = new Oracle.DataAccess.Client.OracleConnection(strcon)) { con.Open(); Oracle.DataAccess.Client.OracleCommand cmd = con.CreateCommand(); cmd.CommandText = QuerySqlString; Oracle.DataAccess.Client.OracleDataAdapter dap = new Oracle.DataAccess.Client.OracleDataAdapter(); dap.SelectCommand = cmd; dt = new DataTable(); dap.Fill(dt); con.Close(); } return dt; } 绑定后的结果
数据库字段类型 NCYL NUMBER(8,4);
急 求教下。
不懂得你哪里出问题了
麻烦大哥你把问题描述清楚点啊。