Daniel Rabinovits

Daniel Rabinovits

  • 1.9k
  • 34
  • 2.2k

cant fill dataset

Jan 30 2020 10:22 AM
I run the string in Oracle SQL developer and i get data howerver when I try to fill the dataset I get 0 rows and 0 columns.
 
code is as follows:
 
string from_date = "01/28/2020";
string to_date = "01/29/2020";
 
string queryString = "SELECT d.materialcode AS MATCODE, m.itemdesc AS ITEMS, sum(d.quantity) AS QUANTITY FROM tbldispensed d " +
"right outer join tblmasterinventory m on m.materialcode = d.materialcode " +
"WHERE TO_DATE(d.datedispensed, 'yy/mm/dd') BETWEEN TO_DATE('"+ from_date + "', 'mm/dd/yyyy') " +
"AND TO_DATE('" + to_date + "', 'mm/dd/yyyy') " +
"GROUP BY d.materialcode, m.itemdesc";
 
conn.Open();
OdbcDataAdapter da = new OdbcDataAdapter(queryString, conn);
DataSet ds = new DataSet();
da.Fill(ds);
 
MessageBox.Show(ds.Tables[0].Rows.Count.ToString());
 
I get 0 rows....can you help please 
 
 
 

Answers (4)