2
Answers

sub query value not fill into the dataset

Tushar Pawar

Tushar Pawar

11y
2.3k
1
OleDbConnection OraCon = new OleDbConnection();
                DataSet ds = new DataSet();
                OleDbCommand cmd = new OleDbCommand();
                string connectionstr = ConfigurationManager.ConnectionStrings["augb"].ConnectionString;
                OraCon.ConnectionString = connectionstr;
                OraCon.Open();
                string sql = "select u.LOCATION,count(c.CHAR_CUST_REFERENCE_NO) as Total,(select count(c.CHAR_CUST_REFERENCE_NO) from customers c inner join users u on(c.NUM_CREATED_BY = u.VCHAR_LAPTOPNO) and to_date(c.DT_CREATED_ON)= to_date(sysdate) ) as Today from customers c inner join users u on(c.NUM_CREATED_BY = u.VCHAR_LAPTOPNO) group by  u.LOCATION";
              
                cmd = new OleDbCommand(sql, OraCon);
              
                OleDbDataAdapter da = new OleDbDataAdapter(cmd);
               
                da.Fill(ds, "cust");
                if (ds.Tables[0].Rows.Count >= 1)
                {
                    GridView1.DataSource = ds;
                    GridView1.DataMember = ds.Tables[0].TableName;
                    GridView1.DataBind();
                }
Answers (2)