我正在尝试从Oracle获取查询以在Visual Studio中显示数据网格视图,但是当我运行程序时,我只在数据网格视图中获得水平线,我不知道我在哪里出错了?
//declarations
//declare sql string
String strSQL, conString;
String dateStart = startDate.ToString(dateFormat), dateEnd = endDate.ToString(dateFormat);
//SQL string
strSQL = "SELECT TO_CHAR(V.CASEID) AS CASEID, V.MESSAGESET, V.LOCALMESSAGETIME, V.TEXT";
strSQL = strSQL + " FROM OPR.V_MKTVALIDATIONMESSAGE V, OPR.MKTCASE C";
strSQL = strSQL + " WHERE V.LOCALMESSAGETIME >= to_date('" + dateStart + "','MM/DD/YYYY hh24')";
strSQL = strSQL + " AND V.LOCALMESSAGETIME < to_date('" + dateEnd + "','MM/DD/YYYY hh24')";
strSQL = strSQL + " AND V.CASEID IS NOT NULL";
strSQL = strSQL + " AND V.CASEID = C.CASEID";
strSQL = strSQL + " AND MESSAGESET = 'EXPORTER'";
strSQL = strSQL + " AND C.STUDYMODEID in (32)";
strSQL = strSQL + " AND (TEXT LIKE 'SCP%Begin exporting%' OR TEXT LIKE 'SCP%Export completed%' OR TEXT LIKE 'ANS%Begin exporting%' OR TEXT LIKE 'ANS%Export completed%' OR TEXT LIKE 'SCD%Begin exporting%' OR TEXT LIKE 'SCD%Export completed%')";
strSQL = strSQL + " ORDER BY CASEID, V.LOCALMESSAGETIME ASC";
//setup the connection string aka username, password, and database to connect to
conString = "Data Source=OPRPRD;User ID=" + userN + ";Password = " + pass + ";Unicode=True";
//create connection object
OracleConnection con = new OracleConnection(conString);
//open connection
con.Open();
//decalare oracle connection
OracleCommand ocom = new OracleCommand();
//assign connection to command
ocom.Connection = con;
//assign command string to oracle command
ocom.CommandText = strSQL;
OracleDataAdapter dataAdapter = new OracleDataAdapter();
dataAdapter.SelectCommand = ocom;
dataAdapter.Fill(ds, "itscedExportTable");
Console.WriteLine("{0}", ds.Tables.ToString());
dataGrid1.DataContext = ds;
dataGrid1.ItemsSource = "itscedExportTable";
con.Close();