我有一個表說emp,因爲我沒有任何值。如果我使用此查詢在asp.net編碼中包含「選擇EMP *」:如何從數據庫中獲取數據時出錯信息,但沒有值
con.Open();
String str="select * from emp where empname='Abdul'";
cmd=new SqlCommand(str,con);
SqlDataReader dr=cmd.ExecuteReader();
while(dr.Read())
{
textBox1.text=dr[0].ToString();
textBox2.text=dr[0].ToString();
textBox3.text=dr[0].ToString();
}
con.Close();
在EMP表中,我沒有任何empname作爲阿卜杜勒,當我這樣做,它應該表現出一些錯誤,怎麼做?
你能告訴我怎麼做那個? –
看到從BizApps以上的其他答案,並表決他的解決方案:) –
我投了他,但它顯示投票需要15名聲譽...... –