易截截图软件、单文件、免安装、纯绿色、仅160KB
热门标签: c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 最新文章 :

在asp.net 2.0中使用SqlBulkCopy类迁移数据

我们经常要在一个表中将数据迁移到另一个表,当然,用的方法十分多了。在.net 2.0中,提供了一个sqlbulkcopy类,也可以实现如下的操作,下面简单介绍下。比如一个表如下
CREATE TABLE Person3
(
PersonID int IDENTITY(1,1) PRIMARY KEY,
Name nvarchar(200),
Email nvarchar(200),
Picture image
)
INSERT INTO Person3(Name,Email,Picture)
SELECT Name,Email,Picture from Person
假设person表已经存在了,则上面的语句可以往person3表中插入数据(在sql server 2005中执行)。现在我们使用下面的代码来实现
string connectionString = ConfigurationManager.ConnectionStrings["MyDatabase"].ConnectionString;
SqlConnection myConnection = new SqlConnection(connectionString);
SqlCommand myCommand = new SqlCommand("SELECT * from Person", myConnection);
myConnection.Open();
SqlDataReader dr = myCommand.ExecuteReader();
SqlConnection myNewConnection = new SqlConnection(connectionString);
myNewConnection.Open();
SqlBulkCopy bulk = new SqlBulkCopy(myNewConnection);
bulk.DestinationTableName = "[Person3]";
try
{ ......

asp.net时间格式

DateTime dt = DateTime.Now;
//    Label1.Text = dt.ToString();//2005-11-5 13:21:25
//    Label2.Text = dt.ToFileTime().ToString();//127756416859912816
//    Label3.Text = dt.ToFileTimeUtc().ToString();//127756704859912816
//    Label4.Text = dt.ToLocalTime().ToString();//2005-11-5 21:21:25
//    Label5.Text = dt.ToLongDateString().ToString();//2005年11月5日
//    Label6.Text = dt.ToLongTimeString().ToString();//13:21:25
//    Label7.Text = dt.ToOADate().ToString();//38661.5565508218
//    Label8.Text = dt.ToShortDateString().ToString();//2005-11-5
//    Label9.Text = dt.ToShortTimeString().ToString();//13:21
//    Label10.Text = dt.ToUniversalTime().ToString();//2005-11-5 5:21:25
//     2005-11-5 13:30:28.4412864
//    Label1.Text = dt.Year.ToString();//2005
//    ......

c:\windows\temp目录权限设置

说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。
编译器错误信息: CS0016: 未能写入输出文件“c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\5bad199f\ab65559a\App_Web_index.aspx.cdcab7d2.anxmasko.dll”--“拒绝访问。 ”
源错误:
 
[没有相关的源行]
源文件:    行: 0
“/”应用程序中的服务器错误。
编译错误
c:\windows\temp\重要性
c:\windows\temp\与服务器的稳定之间有非常大的关系。
大家优化什么的,都不要乱来.
1有人说我把c:\windows\temp里的文件全删了!
2 有人说 ,看到C:\WINDOWS\Temp目录下有8个G将近 这些都是.dat和.tmp的,有用吗这些东西?怎么减小占的空间啊
结果,这样那样的出错.
zend 出错,mysql出错, 附件传不了, 优化出如此结果,何必.
C:/windows/Temp,是系统临时文件夹,里面的文件时系统运行时产生的临时文件 但是不代表,可以随便删除.
另转一,大家看.
C:\windows\Temp权限对数据库的影响
连接Access错误..N久没有用Access了....就算把数据库给IIS用户完全的权 ......

图片文件上传, 生成高质量缩略图 (asp.net c#)

后台代码:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.IO;
public partial class User_UpLoadFile : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void UPbutton_Click(object sender, EventArgs e)
{
if (FileUpload1.HasFile)
{
string fileContentType = FileUpload1.PostedFile.ContentType;
if (fileContentType == "image/bmp" || fileContentType == "image/gif" || fileContentType == "image/pjpeg")
{
string name = FileUpload1.PostedFile.FileName; // 客户端文件路径
FileInfo file = new FileInfo(name);
string SavePath = "/upload/";
string fileExes = (System.IO.Path.GetExtension(name)).ToString().ToLower();//文件扩展名
Random ran = new Ran ......

图片文件上传, 生成高质量缩略图 (asp.net c#)

后台代码:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.IO;
public partial class User_UpLoadFile : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void UPbutton_Click(object sender, EventArgs e)
{
if (FileUpload1.HasFile)
{
string fileContentType = FileUpload1.PostedFile.ContentType;
if (fileContentType == "image/bmp" || fileContentType == "image/gif" || fileContentType == "image/pjpeg")
{
string name = FileUpload1.PostedFile.FileName; // 客户端文件路径
FileInfo file = new FileInfo(name);
string SavePath = "/upload/";
string fileExes = (System.IO.Path.GetExtension(name)).ToString().ToLower();//文件扩展名
Random ran = new Ran ......

asp.net中常用的26个优化性能的方法

1. 数据库访问性能优化 
 
数据库的连接和关闭
访问数据库资源需要创建连接、打开连接和关闭连接几个操作。这些过程需要多次与数据库交换信息以通过身份验证,比较耗费服务器资源。ASP.NET中提供了连接池(Connection Pool)改善打开和关闭数据库对性能的影响。系统将用户的数据库连接放在连接池中,需要时取出,关闭时收回连接,等待下一次的连接请求。连接池的大小是有限的,如果在连接池达到最大限度后仍要求创建连接,必然大大影响性能。因此,在建立数据库连接后只有在真正需要操作时才打开连接,使用完毕后马上关闭,从而尽量减少数据库连接打开的时间,避免出现超出连接限制的情况。   
使用存储过程  
 
存储过程是存储在服务器上的一组预编译的SQL语句,类似于DOS系统中的批处理文件。存储过程具有对数据库立即访问的功能,信息处理极为迅速。使用存储过程可以避免对命令的多次编译,在执行一次后其执行规划就驻留在高速缓存中,以后需要时只需直接调用缓存中的二进制代码即可。另外,存储过程在服务器端运行,独立于ASP.NET程序,便于修改,最重要的是它可以减少数据库操作语句在网络中的传输。
优化查询语句
  
ASP.NET中ADO连接消耗的资源相当大, ......

在asp.net中接收sql server中存储过程的返回值

存储过程代码:
create procedure proc_name
   @para1 nchar(20),    --输入参数
   @para2 int = null output --输出参数,供程序使用
as
begin
   if (@para1='a')
   begin
       insert into employee(name) values(@para1)  
       select @para2=@@identity      --返回添加记录的ID
       return 1                                --返回是否成功添加数据
   end
   else
      return 0                               --返回失败
end
go
在查询分析器中的测试:
decla ......
总记录数:40319; 总页数:6720; 每页6 条; 首页 上一页 [6677] [6678] [6679] [6680] 6681 [6682] [6683] [6684] [6685] [6686]  下一页 尾页
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号