Wednesday 4 January 2012

max value pic and apply to textbox using sql server coding .net

 private void PackingIDFill()
        {//----Fill Packing Id AutoGen

            string msid = " SELECT ISNULL(MAX(PackingId),0) FROM dbo.PackingList";
            SqlDataAdapter da = new SqlDataAdapter(msid, con);
            DataTable dt = new DataTable();
            da.Fill(dt);
            Int32 a = Convert.ToInt32(dt.Rows[0][0].ToString());
            a++; ;
            txtPackingId.Text = a.ToString();
        }

where PackingId is the sql table column which is taken max value

Happy Prog.....
mahesh arya

No comments:

Post a Comment