我有一個表說emp,因爲我沒有任何值。如果我使用此查詢 在asp.net編碼「選擇EMP *」象下面這樣:如何知道Sql Server中的表中是否沒有值
con.Open();
String str="select * from emp where empname="Abdul";
cmd=new SqlCommand(str,con);
SqlDataReader dr=new SqlDataReader();
while(dr.Read())
{
textBox1.text=dr[0].ToString();
textBox2.text=dr[0].ToString();
textBox3.text=dr[0].ToString();
}
con.Close();
在EMP表中,我沒有任何empname作爲阿卜杜勒,當我這樣做它應該顯示一些錯誤, 怎麼做?
我在ASP.NET編碼中使用查詢(select * from emp)... –