asp.net的疑难杂症.....
最近我用vs.net2003尝试写一个三层机构的项目,我用vs.net2003打开解决方案的时候,cpu为100%居高不下....
但是我用vs.net2003打开另一干项目cpu只有百分之几...
估计是程序编写的不规范所造成的....
我数据库层的类是这样写的,本层其他的类写发与之相似...
请高手分析下.....到底是怎么回事....?
using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using mwdoa.Common;
namespace mwdoa.DataAccess
{
public class WorkReports:IDisposable
{
private string strCon;
private SqlConnection cn;
private SqlDataAdapter da;
public WorkReports()
{
strCon=ConfigurationSettings.AppSettings["DSN"];
cn= new SqlConnection(strCon);
da= new SqlDataAdapter();
}
//
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(true);
}
//
protected virtual void Dispose(bool disposing)
{
if(!disposing)
return;
if(da!= null)
{
if(da.SelectCommand!=null)
{
if(da.SelectCommand.Connection!=null)
{
da.SelectCommand.Connection.Dispose();
}
da.SelectCommand.Dispose();
}
da.Dispose();
da=null;
}
}
//添加周报
public bool addWeekReports(int uid,int depid,string bweek,string chayi,string plan,string advices)
{
string mysql="insert into weekreports(uid,Dep_id,B_week,B_chayi,B_plan,B_advice) values('"+uid+"','"+depid+"','"+bweek+"','"+chayi+"','"+plan+"','"+advices+"')";
try
{
SqlCommand cm= new SqlCommand(mysql,cn);
cn.Open();
cm.ExecuteNonQuery();
cn.Close();
return true;
}
catch(SqlException)
{
return false;
}
}
//添加日志
public bool addmyrizhi(int uid,int depid,string title,string content)
{
string mysql="insert into rizhi(r_title,r_content,uid,depid) values('"+title+"','"+content+"','"+uid+"','"+depid+"')";
try
{
SqlCommand cm= new SqlCommand(mysql,cn);
cn.Open();
cm.ExecuteNonQuery();
cn.Close();
return true;
}
catch(SqlException)
{
return false;
}
}
}
}
但是我用vs.net2003打开另一干项目cpu只有百分之几...
估计是程序编写的不规范所造成的....
我数据库层的类是这样写的,本层其他的类写发与之相似...
请高手分析下.....到底是怎么回事....?
using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using mwdoa.Common;
namespace mwdoa.DataAccess
{
public class WorkReports:IDisposable
{
private string strCon;
private SqlConnection cn;
private SqlDataAdapter da;
public WorkReports()
{
strCon=ConfigurationSettings.AppSettings["DSN"];
cn= new SqlConnection(strCon);
da= new SqlDataAdapter();
}
//
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(true);
}
//
protected virtual void Dispose(bool disposing)
{
if(!disposing)
return;
if(da!= null)
{
if(da.SelectCommand!=null)
{
if(da.SelectCommand.Connection!=null)
{
da.SelectCommand.Connection.Dispose();
}
da.SelectCommand.Dispose();
}
da.Dispose();
da=null;
}
}
//添加周报
public bool addWeekReports(int uid,int depid,string bweek,string chayi,string plan,string advices)
{
string mysql="insert into weekreports(uid,Dep_id,B_week,B_chayi,B_plan,B_advice) values('"+uid+"','"+depid+"','"+bweek+"','"+chayi+"','"+plan+"','"+advices+"')";
try
{
SqlCommand cm= new SqlCommand(mysql,cn);
cn.Open();
cm.ExecuteNonQuery();
cn.Close();
return true;
}
catch(SqlException)
{
return false;
}
}
//添加日志
public bool addmyrizhi(int uid,int depid,string title,string content)
{
string mysql="insert into rizhi(r_title,r_content,uid,depid) values('"+title+"','"+content+"','"+uid+"','"+depid+"')";
try
{
SqlCommand cm= new SqlCommand(mysql,cn);
cn.Open();
cm.ExecuteNonQuery();
cn.Close();
return true;
}
catch(SqlException)
{
return false;
}
}
}
}
...全文
相关推荐
Asp.Net知识锦集
这份知识锦集可能还包括对以上各点的深入探讨,以及实际开发中遇到的疑难杂症和相应的解决方案。无论是初学者还是有经验的开发者,都能从中受益,提升自己的Asp.Net技术水平。
asp.net调试器出现的问题及相关解决方法
通过理解和解决这些常见的调试问题,开发者可以更有效地定位和修复ASP.NET应用程序中的错误,从而提高开发效率。在实践中,结合文档、网络资源和社区支持,可以更全面地解决调试中的疑难杂症。
基于ASP的网上考试系统(源代码+论文)(20240z).7z
在ASP.NET环境中,C#可以用来编写服务器端的逻辑代码,能够处理业务逻辑,并且能够很好地与ASP技术结合,提高系统的开发效率和运行性能。
fiddler2
ASP.NET应用分析**对于ASP.NET开发者,Fiddler2同样大有裨益。它可以捕捉到.NET应用发出的所有HTTP请求,这对于调试ASP.NET应用程序的性能、错误以及服务器端逻辑至关重要。
Windows开发从入门到精通源代码讲解和视频第二部分
这部分将探讨如何利用ASP.NET的身份验证服务、角色管理和权限控制,以及如何处理安全异常。"(10):使用.NET开发大型的企业级应用程序"是提升开发能力的挑战。


