Gene said:
Hi, i'm a new vb user,
may i ask how to get the max value from the followin situation?
Dataset name: dataset11
Table name: Employee
Column name: StaffID
the syntax is???
txtMaxStaffID.text = dataset11.Employee.StaffIDColumn.????????
This question will be better answered by the ADO.NET group. However, I
*think* you can accomplish this two ways:
1) select an aggregate of the desired column in your actual SQL statement:
SELECT MAX( StaffID ) FROM [Employee]
GROUP BY {add your grouping fields here}
That will return 1 column, with the max values based on your grouping.
2) (not sure if this will work or not)Try using the MAX function in the
select query on the DataSet:
dataset11.Select("SELECT MAX(StaffID) FROM [EMPLOYEE]...")
This is the same as the previous method, but it all executes client side,
wich is much better in terms of server abuse. I think it returns either a
DataRowView, or a DataRow( ). If you are having problems with this method,
check the documentation on the DataSet.Select() method.
HTH,
Jeremy