Oracle DB Querry Application Error
-
Hi Guys, I want to insert in a list view all the Table Names from a Oracle DB. I started by learning how from Syed M Hussain 's post : A Very Simple Oracle Query Tool[^]
using Oracle.DataAccess.Client; using Oracle.DataAccess.Types; ..... static private OracleConnection orcCon; private static OracleCommand cmd; private static OracleDataAdapter da; private static OracleCommandBuilder cb; private static DataSet ds; private static String sql; ..... public static DataTable GetUserTables() { sql = "SELECT TABLE_NAME FROM USER_TABLES"; cmd = new OracleCommand(sql, OrcCon); cmd.CommandType = CommandType.Text; da = new OracleDataAdapter(cmd); cb = new OracleCommandBuilder(da); ds = new DataSet(); da.Fill(ds); return ds.Tables[0]; } ........... dtTable = Code.ConectareOracle.GetUserTables(); for (int i = 0; i < dtTable.Rows.Count; i++) { MessageBox.Show(dtTable.Rows[i].ToString()); } ....
..and the error i get is that da.Fill(ds) has : "Attempted to read or write protected memory. This is often an indication that other memory is corrupt." Any ideea? Kind regards, Alex“Be the change you want to see in the world.”
-
Hi Guys, I want to insert in a list view all the Table Names from a Oracle DB. I started by learning how from Syed M Hussain 's post : A Very Simple Oracle Query Tool[^]
using Oracle.DataAccess.Client; using Oracle.DataAccess.Types; ..... static private OracleConnection orcCon; private static OracleCommand cmd; private static OracleDataAdapter da; private static OracleCommandBuilder cb; private static DataSet ds; private static String sql; ..... public static DataTable GetUserTables() { sql = "SELECT TABLE_NAME FROM USER_TABLES"; cmd = new OracleCommand(sql, OrcCon); cmd.CommandType = CommandType.Text; da = new OracleDataAdapter(cmd); cb = new OracleCommandBuilder(da); ds = new DataSet(); da.Fill(ds); return ds.Tables[0]; } ........... dtTable = Code.ConectareOracle.GetUserTables(); for (int i = 0; i < dtTable.Rows.Count; i++) { MessageBox.Show(dtTable.Rows[i].ToString()); } ....
..and the error i get is that da.Fill(ds) has : "Attempted to read or write protected memory. This is often an indication that other memory is corrupt." Any ideea? Kind regards, Alex“Be the change you want to see in the world.”
use Query "select * from tab where TABTYPE='TABLE'" instead of "SELECT TABLE_NAME FROM USER_TABLES" the problem may be , your user don't have the sufficient previlizes.
Rajesh B --> A Poor Workman Blames His Tools <--