예제 #1
0
        /// <summary>
        /// Executes a sqlscript and returns a SQLDATAREADER
        /// </summary>
        /// <param name="hostName">Server name</param>
        /// <param name="instanceName">Database Instance name</param>
        /// <param name="databaseName">Database name</param>
        /// <param name="sqlString">SQL statment</param>
        public static void ExecuteSQlCommand(string hostName, string instalnceName, string databaseName, string sqlString)
        {
            using (SqlObjectWrapper sqlObjectWrapper = new SqlObjectWrapper(hostName, instalnceName, databaseName))
            {
                SqlDataReader dr = sqlObjectWrapper.ExecuteSqlCommands(sqlString);

                // close the reader
                dr.Close();
                dr.Dispose();
            }
        }
예제 #2
0
        /// <summary>
        /// Checks if a result of a SQL statment exists
        /// </summary>
        /// <param name="hostName">Server name</param>
        /// <param name="instanceName">Database Instance name</param>
        /// <param name="databaseName">Database name</param>
        /// <param name="sqlString">SQL statment</param>
        /// <returns>True if the result exists, false otherwise</returns>
        public static bool SqlObjectExists(string hostName, string instalnceName, string databaseName, string sqlString)
        {
            bool exists = false;

            using (SqlObjectWrapper sqlObjectWrapper = new SqlObjectWrapper(hostName, instalnceName, databaseName))
            {
                using (SqlDataReader dr = sqlObjectWrapper.ExecuteSqlCommands(sqlString))
                {
                    exists = dr.HasRows;
                }
            }
            return(exists);
        }
예제 #3
0
 /// <summary>
 /// Checks if a result of a SQL statment exists
 /// </summary>
 /// <param name="hostName">Server name</param>
 /// <param name="instanceName">Database Instance name</param>
 /// <param name="databaseName">Database name</param>
 /// <param name="sqlString">SQL statment</param>
 /// <returns>True if the result exists, false otherwise</returns>
 public static bool SqlObjectExists(string hostName,string instalnceName, string databaseName, string sqlString)
 {
     bool exists = false;
     using (SqlObjectWrapper sqlObjectWrapper = new SqlObjectWrapper(hostName, instalnceName, databaseName))
     {
         using (SqlDataReader dr = sqlObjectWrapper.ExecuteSqlCommands(sqlString))
         {
             exists = dr.HasRows;
         }
     }
     return exists;
 }
예제 #4
0
        /// <summary>
        /// Executes a sqlscript and returns a SQLDATAREADER 
        /// </summary>
        /// <param name="hostName">Server name</param>
        /// <param name="instanceName">Database Instance name</param>
        /// <param name="databaseName">Database name</param>
        /// <param name="sqlString">SQL statment</param>
        public static void ExecuteSQlCommand(string hostName, string instalnceName, string databaseName, string sqlString)
        {
            using (SqlObjectWrapper sqlObjectWrapper = new SqlObjectWrapper(hostName, instalnceName, databaseName))
            {
                SqlDataReader dr = sqlObjectWrapper.ExecuteSqlCommands(sqlString);

                // close the reader
                dr.Close();
                dr.Dispose();
            }
        }