470,822 Members | 1,375 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,822 developers. It's quick & easy.

"Object reference not set to an instance of an object.".....error

i wrote the following code to get a specific data row from the data set.but it generates the
"Object reference not set to an instance of an object.".....error
private void showClientListForUser()
string[] fkeys = new string[2];

fkeys[0] = txtUserName.Text;
fkeys[1] = txtUserCompanyNumber.Text;

DataSet ds = new DataSet();
DataRow dr = null;

for (int i = 0; i < dsMain.Tables["UserClient"].Rows.Count; i++)
dr[i] = dsMain.Tables["UserClient"].Select("UserID="+"'"+fkeys[0]+"'"+ "and CompNo= " + fkeys[1]);------//this line throws the error i told.

// dr = ds.Tables[0].Rows[i];
if anyone can help me to correct this error?
Sep 27 '07 #1
0 1100

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by My Pet Programmer | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.