C#编写的生成缩略图程序(转)
if(fileupload.PostedFile!=null) { //addto为要添加的属性,aboutfile为文件说明 string nam = fileupload.PostedFile.FileName ; //取得文件名(抱括路径)里最后一个"."的索引 int i= nam.LastIndexOf("."); //取得文件扩展名 string newext =nam.Substring(i); //这里我自动根据日期和文件大小不同为文件命名,确保文件名不重复 DateTime now = DateTime.Now; string newname=now.DayOfYear.ToString()+fileupload.PostedFile.ContentLength.ToString();
用C#生成Excel文件的方法和Excel.dll组件生成的方法(转)
一个示例:class AppTest { private Excel.ApplicationClass _x; public static void Main0() { AppTest a = new AppTest(); a._x = new Excel.ApplicationClass(); a._x.UserControl = false; for (int i = 0 ;i < 4; i++) { a.SaveToXls("D: est" + i + ".xls"); // 本例是在D盘下建立的test文件夹 } a._x.Quit(); System.Runtime.InteropServices.Marshal.ReleaseComObject((object) a._x); System.GC.Collect(); } private void SaveToXls(string filename) { Excel.Work
TREEVIEW只输入表名,父ID,节点ID,节点名就得到树型结构之二十八(转)
/// <summary> /// Deep copy of cached SqlParameter array /// </summary> /// <param name="originalParameters"></param> /// <returns></returns> private static SqlParameter[] CloneParameters(SqlParameter[] originalParameters) { SqlParameter[] clonedParameters = new SqlParameter[originalParameters.Length]; for (int i = 0, j = originalParameters.Length; i < j; i++) { clonedParameters[i] = (SqlParameter)((ICloneable)originalParameters[i])
TREEVIEW只输入表名,父ID,节点ID,节点名就得到树型结构之二十七(转)
/// <summary> /// SqlHelperParameterCache provides functions to leverage a static cache of procedure parameters, and the /// ability to discover parameters for stored procedures at run-time. /// </summary> public sealed class SqlHelperParameterCache { #region private methods, variables, and constructors //Since this class provides only static methods, make the default constructor private to prevent //instances from being created with "new SqlHelperParameterCache()" pri
TREEVIEW只输入表名,父ID,节点ID,节点名就得到树型结构之二十六(转)
#region ExecuteXmlReaderTypedParams /// <summary> /// Execute a stored procedure via a SqlCommand (that returns a 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 parameter order. /// </summary> /// <param name="con
TREEVIEW只输入表名,父ID,节点ID,节点名就得到树型结构之二十五(转)
#region ExecuteScalarTypedParams /// <summary> /// Execute a stored procedure via a SqlCommand (that returns a 1x1 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 parameter order. /// </summary> /// <
TREEVIEW只输入表名,父ID,节点ID,节点名就得到树型结构之二十四(转)
#region ExecuteReaderTypedParams /// <summary> /// Execute a stored procedure via a SqlCommand (that returns a 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 parameter order. /// </summary> /// <par
TREEVIEW只输入表名,父ID,节点ID,节点名就得到树型结构之二十三(转)
/// <summary> /// Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified SqlConnection /// using the dataRow column values as the store 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 obje
TREEVIEW只输入表名,父ID,节点ID,节点名就得到树型结构之二十二(转)
/// <summary> /// Execute a stored procedure via a SqlCommand (that returns no resultset) against the specified /// SqlTransaction 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="transaction">A valid SqlTransaction
TREEVIEW只输入表名,父ID,节点ID,节点名就得到树型结构之二十一(转)
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. /// <
TREEVIEW只输入表名,父ID,节点ID,节点名就得到树型结构之二十(转)
#region CreateCommand /// <summary> /// Simplify the creation of a Sql command object by allowing /// a stored procedure and optional parameters to be provided /// </summary> /// <remarks> /// e.g.: /// SqlCommand command = CreateCommand(conn, "AddCustomer", "CustomerID", "CustomerName"); /// </remarks> /// <param name="connection">A valid SqlConnection object</param> /// <param name="spName">
TREEVIEW只输入表名,父ID,节点ID,节点名就得到树型结构之十九(转)
/// <summary> /// Execute a SqlCommand (that returns a resultset and takes no parameters) against the provided SqlConnection. /// </summary> /// <remarks> /// e.g.: /// FillDataset(conn, CommandType.StoredProcedure, "GetOrders", ds, new string[] {"orders"}); /// </remarks> /// <param name="connection">A valid SqlConnection</param> /// <param name="commandType">The CommandType (stored procedure, text, et
TREEVIEW只输入表名,父ID,节点ID,节点名就得到树型结构之十七(转)
/// <summary> /// Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified /// SqlTransaction using the provided parameter 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 parameter order. /// </summary> /// <remarks> /// This method provides no access to output parameters or the stored procedure's retur
TREEVIEW只输入表名,父ID,节点ID,节点名就得到树型结构之十八(转)
/// <summary> /// Execute a SqlCommand (that returns a resultset) against the database specified in the connection string /// using the provided parameters. /// </summary> /// <remarks> /// e.g.: /// FillDataset(connString, CommandType.StoredProcedure, "GetOrders", ds, new string[] {"orders"}, new SqlParameter("@prodid", 24)); /// </remarks> /// <param name="connectionString">A valid connection string for a SqlConn
TREEVIEW只输入表名,父ID,节点ID,节点名就得到树型结构之十六(转)
/// <summary> /// Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified SqlConnection /// using the provided parameter 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 parameter order. /// </summary> /// <remarks> /// This method provides no access to output parameters or the stored procedure's return
TREEVIEW只输入表名,父ID,节点ID,节点名就得到树型结构之十五(转)
#region ExecuteXmlReader /// <summary> /// Execute a SqlCommand (that returns a resultset and takes no parameters) against the provided SqlConnection. /// </summary> /// <remarks> /// e.g.: /// XmlReader r = ExecuteXmlReader(conn, CommandType.StoredProcedure, "GetOrders"); /// </remarks> /// <param name="connection">A valid SqlConnection</param> /// <param name="commandType">The CommandType (stored procedure, te
TREEVIEW只输入表名,父ID,节点ID,节点名就得到树型结构之十三(转)
/// <summary> /// Execute a stored procedure via a SqlCommand (that returns a 1x1 resultset) against the specified SqlConnection /// using the provided parameter 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 parameter order. /// </summary> /// <remarks> /// This method provides no access to output parameters or the stored procedure's re
TREEVIEW只输入表名,父ID,节点ID,节点名就得到树型结构之十四(转)
/// <summary> /// Execute a SqlCommand (that returns a 1x1 resultset) against the specified SqlTransaction /// using the provided parameters. /// </summary> /// <remarks> /// e.g.: /// int orderCount = (int)ExecuteScalar(trans, CommandType.StoredProcedure, "GetOrderCount", new SqlParameter("@prodid", 24)); /// </remarks> /// <param name="transaction">A valid SqlTransaction</param> /// <param name="commandType&q
TREEVIEW只输入表名,父ID,节点ID,节点名就得到树型结构之十二(转)
// Call the overload that takes an array of SqlParameters return ExecuteScalar(connectionString, CommandType.StoredProcedure, spName, commandParameters); } else { // Otherwise we can just call the SP without params return ExecuteScalar(connectionString, CommandType.StoredProcedure, spName); } } /// <summary> /// Execute a SqlCommand (that returns a 1x1 resultset and takes no parameters) against the provided SqlConnection. /// </summary> /// <remarks> /
TREEVIEW只输入表名,父ID,节点ID,节点名就得到树型结构之十一(转)
/// <summary> /// Execute a SqlCommand (that returns a resultset) against the specified SqlTransaction /// using the provided parameters. /// </summary> /// <remarks> /// e.g.: /// SqlDataReader dr = ExecuteReader(trans, CommandType.StoredProcedure, "GetOrders", new SqlParameter("@prodid", 24)); /// </remarks> /// <param name="transaction">A valid SqlTransaction</param> /// <param name="commandType">Th