6TTW014
6TTW014

Reputation: 627

Get Data From Specific Column

I have the below code to search by EmployeeID to find BirthDate but it doesn't seem to work and I'm unsure why, it says something about invalid arguments. Any ideas?

String birthDate = dsEmployees.Employees.FindByEmployeeID(ID).BirthDate.ToString();

Just says :

1 The best overloaded method match for 'Northwind.dsEmployees.EmployeesDataTable.FindByEmployeeID(int)' has some invalid arguments C:\Users\Kimmy\Documents\Visual Studio 2008\Projects\Northwind\Northwind\frmSignIn.cs 43 33 Northwind

Upvotes: 0

Views: 165

Answers (3)

Bala R
Bala R

Reputation: 108937

try

String birthDate = 
    dsEmployees.Employees.FindByEmployeeID(Convert.ToInt32(ID.ToString())).BirthDate.ToString();

Upvotes: 1

Tristan Dubé
Tristan Dubé

Reputation: 740

I'm not sure how your FindByEmployeeID() function work but taking the value of a single cell in a dataset is usually done this way :

dataSet.Tables["tablename"].Rows["rowNumber"]["ColumnName"].toString();

Upvotes: 0

Marino Šimić
Marino Šimić

Reputation: 7332

Invalid Argument often means that you are passing a wrong parameter to a function. This probably means the variable ID is not ok :)

But you have provided less than enough information to solve your problem.

Upvotes: 1

Related Questions