2 duan1437895747 duan1437895747 于 2013.06.26 13:59 提问

为什么我查不出数据来,请各位看一下

SqlConnection conn = new SqlConnection("Data Source=.;Initial Catalog=ImmigrationControlManager;User ID=sa;Password=");
string sql = @"SELECT CRRQ, CRRQSJ, JTGJBS,
(select count(ZJHM) from BJ_YW_T_CRJRY where
CRRQ = TAB_HB.CRRQ AND
JTGJBS = TAB_HB.JTGJBS AND
SUBSTR(RYLBDM, 0, 1) = '2') as coun,
(select count(ZJHM) from BJ_YW_T_CRJRY where
CRRQ = TAB_HB.CRRQ AND
JTGJBS = TAB_HB.JTGJBS AND
SUBSTR(RYLBDM, 0, 1) = '4') as coun2
FROM (SELECT MAX(CRRQ) AS CRRQ, MAX(CRRQSJ) AS CRRQSJ, JTGJBS
FROM BJ_YW_T_CRJRY
WHERE CRRQ = TO_CHAR(SYSDATE, 'yyyymmdd') AND (CRBZ = 2)
GROUP BY JTGJBS) TAB_HB
ORDER BY CRRQSJ DESC";
conn.Open();
SqlDataAdapter sda = new SqlDataAdapter(sql, conn);
DataSet ds = new DataSet();
sda.Fill(ds);
dataGridView1.DataSource = ds;
conn.Close();

1个回答

longlonglo
longlonglo   2017.08.08 15:44

这个要看一下你的数据了! 现在 sql manage中运行一下你的 sql语句 看看有没有数据

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!