oracle 11gに接続しようとしましたが、問題が発生し、以下のエラーが発生します。エラーは、sql構文に問題があるはずですが、oraclesqldeveloperで実行しています。クエリは正しいです。この問題の解決にご協力ください
。ありがとうございます。
try {
string oradb = "Data Source=(DESCRIPTION="
+ "(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=xxx-PC)(PORT=1521)))"
+ "(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));"
+ "User Id=xxxx;Password=123456;";
OracleConnection con = new OracleConnection();
con.ConnectionString = oradb;
//String command = "Select Object_name,status from object_name where object_type='" + object_typeCB.SelectedText + "'";
string command = "select column1,column2,column3 from table1;";
OracleDataAdapter oda = new OracleDataAdapter();
oda.SelectCommand = new OracleCommand();
oda.SelectCommand.Connection = con;
oda.SelectCommand.CommandText = command;
con.Open();
oda.SelectCommand.ExecuteNonQuery();
DataSet ds = new DataSet();
oda.Fill(ds);
dataGridView1.DataSource = ds;
con.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString()+Environment.NewLine+ ex.StackTrace.ToString());
}
エラー:
ORA-00911: invalid character
at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure, Boolean bCheck)
at Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, String procedure, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, Boolean bCheck)
at Oracle.DataAccess.Client.OracleCommand.ExecuteNonQuery()
at FileChecker.dropFrame.applyBt_Click(Object sender, EventArgs e) in C:\Users\rima\Documents\Visual Studio 2008\Projects\FileChecker\FileChecker\DropFrame.cs:line 61