Check if a record exists in the database

前端 未结 13 1708
借酒劲吻你
借酒劲吻你 2020-11-28 12:58

I am using these lines of code to check if the record exists or not.

SqlCommand check_User_Name = new SqlCommand(\"SELECT * FROM Table WHERE ([user] = \'\" +         


        
13条回答
  •  感情败类
    2020-11-28 13:20

    sda = new SqlCeDataAdapter("SELECT COUNT(regNumber) AS i FROM  tblAttendance",con);
    sda.Fill(dt);
    
    string i = dt.Rows[0]["i"].ToString();
    int bar = Convert.ToInt32(i);
    
    if (bar >= 1){
    
        dt.Clear();
        MetroFramework.MetroMessageBox.Show(this, "something");
    }
    else if(bar <= 0) {
    
        dt.Clear();
        MetroFramework.MetroMessageBox.Show(this, "empty");
    }
    

提交回复
热议问题