本文介绍了创建一个函数来查找任何表的maxid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi
我想要这样的东西:



  public   int  FindMaxId( string  TableName)
{
int i = 0 ;
if ' db。' + TableName + ' 。ToList()。Count()> 0'
i = db。 TableName.Max(d = > d.id);
return i;
}





我知道这是错的。我想传递表名,然后返回最大ID。对于任何一个表。

解决方案

hiI would like something like this:

public int FindMaxId(string TableName)
     {
       int i =0;
        if ('db.'+TableName+'.ToList().Count() > 0' )
           i = db. TableName.Max(d => d.id);
        return i ;
     }



i know it's wrong .i wanna pass the name of table , and it returns max id. for any table.

解决方案


这篇关于创建一个函数来查找任何表的maxid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-26 12:13
查看更多