Link to home
Start Free TrialLog in
Avatar of jeff Lee
jeff Lee

asked on

Send field name and DataTable as parameters to Function in C#

Hi,
   When I insert data to some table, I must get the max serial number on the table for now. I create a function to get max serial number on the table.
    How to write the following code to send field name and DataTable  as parameters to Function.
public static int U_MaxSN(string vfield, string vTable)
{
  cmd = "select max(vfield) seriesno from vTable"    <-----here is my problem.
}

Open in new window

   If I want to get the max serial number on some table .
    vs_seriesno = U_MaxSN(some field name, some table name);

   Thanks.

jeff
ASKER CERTIFIED SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jeff Lee
jeff Lee

ASKER

Hi Éric Moreau,

   That's correct.   You are the best.

   Thanks.
 
   jeff