#region executes the INSERT statement and returns the current ID///<summary>///executes the INSERT statement and returns the current ID///</summary>///<param name= "Strinsert" >& lt;/param>///<param name= "Parainsert" ></param>///<param name= "strtable" >[yhkwebdata]. [dbo]. [t_message]</param>///<returns></returns> Private int ExecuteSQL (string strinsert, System.data.sqlclient.sqlparameter[] Paraminsert, String strtable) {String connectionString = configurationmanager.connectionstrings["Datacenterconnectionstring"]. ToString (); using (SqlConnection conn = new SqlConnection (connectionString)) {Conn. Open (); using (sqltransaction trans = conn. BeginTransaction ()) {SqlCommand cmd = new SqlCommand (); try {dbhelpersql.preparecommand (cmd, Conn,trans, Strinsert, para Minsert); int rows = cmd. ExecuteNonQuery (); Cmd. Parameters.clear (); Cmd.commandtext = "Select Ident_current" (' +strtable+ ")"; int Newid=int. Parse (cmd. ExecuteScalar (). ToString ()); Trans.commit (); return NewID; catch {trans. Rollback (); Throw } }}} #endregion