1
//check if user has completed all five tasks
OleDbConnection dbCon = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\zoofari\zoofari\zoofari\MainData.accdb");
OleDbDataAdapter dAdapter = new OleDbDataAdapter();
DataSet ds = new DataSet();
string query = ("select * from tbl_Tasks where Username = '" + _stuUname + "'");
dbCon.Open();
dAdapter = new OleDbDataAdapter(query, dbCon);
OleDbCommandBuilder cBuilder = new OleDbCommandBuilder(dAdapter);
DataTable dTable = new DataTable();
dAdapter.Fill(dTable);
dbCon.Close();
我試圖在向另一個字段寫入真值之前檢查用戶是否完成了5個任務(布爾值爲true),名爲'Completed '在同一張桌子上。我是否需要創建變量來保存前五個值,或者我可以在一個SQL語句中檢查這些變量嗎?我的SQL技能非常基本,所以請儘可能簡單地回覆!謝謝從數據庫表中讀取bool值並寫回一個bool值
您有SQL注入易變性 – SLaks 2013-05-01 15:10:19
「tbl_Tasks」的列是什麼? – Arran 2013-05-01 15:15:10
用戶名1 2 3 4 5完成 – LHammy 2013-05-01 15:16:17