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
C#

Avatar of undefined
Last Comment
jeff Lee
ASKER CERTIFIED SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of jeff Lee
jeff Lee

ASKER

Hi Éric Moreau,

   That's correct.   You are the best.

   Thanks.
 
   jeff
C#
C#

C# is an object-oriented programming language created in conjunction with Microsoft’s .NET framework. Compilation is usually done into the Microsoft Intermediate Language (MSIL), which is then JIT-compiled to native code (and cached) during execution in the Common Language Runtime (CLR).

98K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo