程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> .NET網頁編程 >> C# >> C#基礎知識 >> C#完成C/S架構下地TREEVIEW只輸入表名,父ID,節點ID,節點名就得到樹型結構(4)

C#完成C/S架構下地TREEVIEW只輸入表名,父ID,節點ID,節點名就得到樹型結構(4)

編輯:C#基礎知識

   return cmd;
  }
  #endregion

  #region ExecuteNonQueryTypedParams
  /// <summary>
  /// Execute a stored procedure via a SqlCommand (that returns no resultset) against the database specified in
  /// the connection string using the dataRow column values as the stored procedure's parameters values.
  /// This method will query the database to discover the parameters for the
  /// stored procedure (the first time each stored procedure is called), and assign the values based on row values.
  /// </summary>
  /// <param name="connectionString">A valid connection string for a SqlConnection</param>
  /// <param name="spName">The name of the stored procedure</param>
  /// <param name="dataRow">The dataRow used to hold the stored procedure's parameter values.</param>
  /// <returns>An int representing the number of rows affected by the command</returns>
  public static int ExecuteNonQueryTypedParams(String connectionString, String spName, DataRow dataRow)
  {
   if( connectionString == null || connectionString.Length == 0 ) throw new ArgumentNullException( "connectionString" );
   if( spName == null || spName.Length == 0 ) throw new ArgumentNullException( "spName" );
   
   // If the row has values, the store procedure parameters must be initialized
   if (dataRow != null && dataRow.ItemArray.Length > 0)
   {
    // Pull the parameters for this stored procedure from the parameter cache (or discover them & populate the cache)
    SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(connectionString, spName);
               
    // Set the parameters values
    AssignParameterValues(commandParameters, dataRow);
                               
    return SqlHelper.ExecuteNonQuery(connectionString, CommandType.StoredProcedure, spName, commandParameters);
   }
   else
   {
    return SqlHelper.ExecuteNonQuery(connectionString, CommandType.StoredProcedure, spName);
   }
  }

  /// <summary>
  /// Execute a stored procedure via a SqlCommand (that returns no resultset) against the specified SqlConnection
  /// using the dataRow column values as the stored procedure's parameters values. 
  /// This method will query the database to discover the parameters for the
  /// stored procedure (the first time each stored procedure is called), and assign the values based on row values.
  /// </summary>
  /// <param name="connection">A valid SqlConnection object</param>
  /// <param name="spName">The name of the stored procedure</param>
  /// <param name="dataRow">The dataRow used to hold the stored procedure's parameter values.</param>
  /// <returns>An int representing the number of rows affected by the command</return

[1] [2] [3] [4] [5] [6] [7] [8] [9] [10]  ... 下一頁  >> 

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved