我需要從tbl_Ticket檢索TICKET_ID傳遞到發送電子郵件功能的主體部分.. 是下面的代碼是否正確? 每一個時代,我得到TICKET_ID 1 ..如何從函數中的select查詢返回int值?
public int select_TicketId(){
string strConn = System.Configuration.ConfigurationManager.ConnectionStrings["conString"].ConnectionString.ToString();
SqlConnection sqlCon = new SqlConnection(strConn);
string getId = ("select Ticket_Id from tbl_Ticket where Client_EmailAdd='" + objNewTic_BAL.email + "' ");
sqlCon.Open();
SqlCommand cmd1 = new SqlCommand(getId, sqlCon);
int i=cmd1.ExecuteNonQuery();
return i;
}
感謝ü如此多的工程:) – hks 2012-03-29 11:55:44