예제 #1
0
        public bool RunStatement(SqlLine line)
        {
            try
            {
                var cmd = new SqlCommand
                {
                    Connection  = connection,
                    CommandType = System.Data.CommandType.Text,
                    CommandText = line.Request
                };

                if (line.ParList.Count > 0)
                {
                    cmd.Parameters.AddRange(line.ParList.ToArray());
                }
                this.Open();
                cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                this.Close();
            }
            return(true);
        }
예제 #2
0
        public int RunStatementScalar(SqlLine line)
        {
            int           userid    = 0;
            var           constring = Properties.Settings.Default.Connection;
            SqlConnection con       = new SqlConnection(constring);

            SqlCommand     cmd = new SqlCommand("Insert_User", con);
            SqlDataAdapter da  = new SqlDataAdapter();

            cmd.CommandType = CommandType.StoredProcedure;
            if (line.ParList.Count > 0)
            {
                cmd.Parameters.AddRange(line.ParList.ToArray());
            }
            con.Open();
            userid = Convert.ToInt32(cmd.ExecuteScalar());

            return(userid);
        }