取字段的最大值

        con.Open();
        str = "select MAX(flowstep) as fs from [treat] where usernum='" + lsusernum + " '";
        OleDbCommand cmd = new OleDbCommand(str, con);
        OleDbDataReader dr = cmd.ExecuteReader();
        dr.Read();
        lsfs = dr["fs"].ToString();
        if (lsfs.Length !=0)
        {
            lsflowstep = Convert.ToInt32(lsfs)+1;
        }
        else
        {
            lsflowstep = 1;
        }
        dr.Close();
        con.Close();

你可能感兴趣的:(字段)