2017-10-10 115 views
-1

我有一個名爲dtr的表,它有5列:idstudent_idtime_intime_outdate如何插入空值列/更新數據?

我做我的項目是什麼,讓用戶輸入自己的ID號,然後將程序掃描,如果ID號碼在數據庫中。如果是在數據庫中的ID號碼的第一輸入將以time_in列插入數據。並且在相同的ID號碼的第二輸入將在time_out柱插入數據。

這是我希望發生的:

if(inputtedIDNumber == fromDatabase) 
{ 
    //ID Number found 
    if(the column 'time_out' is null) 
    { 
     //update the row that 'time_in' has a value and add time in 'time_out' column 
    } 
    else 
    { 
     //add new row and will insert ID Number, time_in, and date 
    } 
} 
else 
{ 
    //ID number not found 
} 
+0

我在代碼中看不到空值。 – Richard

+0

@Richard我編輯它,希望你能理解我。 –

+1

那麼什麼是問題/問題? – SeM

回答