select replace( replace( replace( replace(convert(varchar(23),getdate(),121),'-',''),':',''),' ',''),'.','')

Random rn = new Random();    //  声明随机数对象 
this.TextBox1.Text = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + rn.Next(8885).ToString();

05-26 08:25