简体   繁体   中英

get system name from application

Hi I am inserting data to mfprintwo table as shown

Program.GetConnection().CommandType = CommandType.Text;
                    //Program.GetConnection().CommandText = "UPDATE dbo.mfworkorder SET jobstarted=1,lasteditdt=GETDATE() WHERE workorderno=@WorkOrderNo"; // ID: Alan_20130220_002
                    Program.GetConnection().CommandText = "insert into dbo.mfprintwo ( sysserialno,workorderno,seqno,lasteditdt,lasteditby) values(@Sysserialno,@WorkOrderNo,@Seqno,getdate(),@currentuser) ";
                    Program.GetConnection().AddParameter("@WorkOrderNo", workorderno);
                    Program.GetConnection().AddParameter("@currentuser", Program.MfSfcCtrl.User.Logonname);
                    Program.GetConnection().AddParameter("@Sysserialno", product.Sysserialno);
                    Program.GetConnection().AddParameter("@Seqno", product.Seqno);
                    Program.GetConnection().ExecuteNonQuery();

In this code @currentuser is the person who login to the application. but instate of that i want to insert the system name in which application running. is it possible? and how to do that?

Would machine name work? If so, you may do

System.Environment.MachineName

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM