11
Reply

Object reference not set to an instance of an object.

lynn tan

lynn tan

Jun 20 2006 11:59 PM
2.9k
hi can someone please help me with this.. i kept getting this error Object reference not set to an instance of an object. i am just beginning to write my first program and still learning.. i know that i have to instantiate my dataset and i guess i did instantiate.. the coding is as follows public static DataSet ds; private void BtnLogin_Click(object sender, EventArgs e) { CustomerMS.localhost.Service1 cms = new CustomerMS.localhost.Service1(); ds = cms.GetUserInfo(txtUser.Text.Trim(), txtPwd.Text.Trim()); uid = txtUser.Text.Trim(); pwd = txtPwd.Text.Trim(); if ((int)ds.Tables["Check User"].Rows[0].ItemArray[0] > 0) { this.Hide(); frmMain main = new frmMain(); main.Show(); } else { MessageBox.Show("You didnt enter the right User ID or Password", "Invalid User ID or Password", MessageBoxButtons.OK, MessageBoxIcon.Error); } } and i am using web services and when i tried to retrive the data direct via web services i get the correct data but when i tried to retrive via my client, i saw the ds.tables have the Data in it but in ds.tables["check user"] it just shows null. whats going on? please help..

Answers (11)