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 inv开发者_如何学Pythonalid 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
try
String birthDate =
dsEmployees.Employees.FindByEmployeeID(Convert.ToInt32(ID.ToString())).BirthDate.ToString();
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.
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();
精彩评论