greenapple.Conner.nonqry C# (CSharp) Method

nonqry() public method

executes upadte,delete and insert statements since they donot require any special return
public nonqry ( string sqlstr ) : int
sqlstr string SQL statement
return int
        public int nonqry(string sqlstr)
        {
            int se = 0;
            try
            {
                if (conn.State == ConnectionState.Open)
                { }
                else
                    conn.Open();

                comm = conn.CreateCommand();
                comm.CommandText = sqlstr;
                se = comm.ExecuteNonQuery();
                conn.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\nSQL:" + sqlstr);
            }
            return se;
        }