我有一个问题,如果返回的值不为空,这会起作用,但是System.NullreferenceException当返回为空时我得到一个。我尝试了很多东西,但似乎无法破解它。这里的任何帮助将不胜感激。
string HwPlts = "select top 1 plts from (select sum(ISNULL(Heywood_Plts, 0)) as plts, date_Uploaded, time_Uploaded, Upload_ID from InboundRawData Group by date_Uploaded, time_Uploaded, dispatch_Date, Upload_ID having dispatch_Date = @prod_Date) as p order by Upload_ID desc";
SqlCommand cmd1001 = new SqlCommand(HwPlts, connection);
cmd1001.Parameters.AddWithValue("@prod_Date", dateTimePicker1.Text);
HWplt.Text = cmd1001.ExecuteScalar().ToString();
慕标琳琳
相关分类