4
Answers

Runtime Error: Object reference not set to an instance of an object. --> please help me

wooi83

wooi83

20y
6.3k
1
int bookID = int.Parse(txtboxSearchbyISBN.Text); dsBookISBN = SearchData.ListBookByISDN(bookID); DataSet dsBookISBN = new DataSet(); Services SearchData = new Services(); DataRow dr; int bookID = int.Parse(txtboxSearchbyISBN.Text); dsBookISBN = SearchData.ListBookByISDN(bookID); try{ dr = dsBookISBN.Tables["Table"].Rows[0]; //<----- i have errors on this line lbltitle.Text= "Book Title :" + dr["bookTitle"].ToString(); lblauthor.Text = "Author :" + dr["bookAuthor"].ToString(); lblisbn.Text= "ISBN :" + dr["bookISBN"].ToString(); lblpubliser.Text= "Publiser :" + dr["bookPublisher"].ToString(); lblyearpublished.Text= "Year Published :" + dr["bookYearPublished"].ToString(); lbldatereceived.Text= "Date Received :" + dr["bookDateReceived"].ToString(); lblcategory.Text= "Category :" + dr["bookCategory"].ToString(); lblloanstatus.Text= "Loan Status :" + dr["bookLoanStatus"].ToString(); ActiveForm = frmSearchResult; } catch(System.IndexOutOfRangeException) { lblError.Visible = true; }
Answers (4)