SqlConnection m_sqlconn = tb_SQLAccess.GetSQLConn();
                m_sqlconn.Open();
                SqlCommand m_sqlcomm = new SqlCommand();
                string m_comm_2 = "select top(1) fdID from Prov order by fdID desc";
                m_sqlcomm.Connection = m_sqlconn;
                m_sqlcomm.CommandText = m_comm_2;

                string id = m_sqlcomm.ExecuteScalar().ToString();
                id = "00" + (int.Parse(id) + 1).ToString();
                id = id.Substring(id.Length - 3, 3);
                string m_comm = string.Format("insert into prov (fdID,fdProv,fdNo,fdIfEnter) values('{0}','{1}','{2}',{3})",
                        id, CityName, id, 1);
                m_sqlcomm.CommandText = m_comm;
               
                m_sqlcomm.ExecuteNonQuery();
                m_sqlconn.Close();

 

posted on 2013-10-24 13:31  金海浪  阅读(576)  评论(0编辑  收藏  举报