В C# типа bool количество строк с пустыми столбцами, каждый раз, правда
i have 2 columns book1 and book2 to in borrowes table but some time users borrowed the book and some time no, so i need to delete user which not borrowed any book (book1 or book2). but i got every time value in True... let me know what can i do thanks. i tried this...
Что я уже пробовал:
con.Open(); bool readerHasRows = false; string brid = txtBr_id.Text; String syntax = "SELECT book1, book2 FROM Borrowes WHERE brId = @brid"; using (SqlCommand cmd = new SqlCommand(syntax, con)) { cmd.Parameters.AddWithValue("@brid", txtBr_id.Text); using (SqlDataReader reader = cmd.ExecuteReader()) { readerHasRows = (!reader[0].IsDBNull); } } con.Close(); if (readerHasRows == true) { MessageBox.Show("This borrower has borrowed the book please collect the book first."); }