(1)当开发软件时,不能用代码实现的部分或不能自动化的部分,则设计成让用户操作,和用户交互。
(2)做维护项目时,分析问题时:要先重现用户看到的问题,一般是在UI上,然后向下钻取。最好不要以某人的中间分析结果作为客户的问题来向前分析,因为他的分析结果可能比较狭隘,要以客户的原始问题、原始表现来向下钻取。从上至下钻取问题时最好记下每一步找到的函数名等关键点,代码可使用Bookmark作为标志,数据库的每一步可记在记事本上。到数据存储层时,查看表或存储过程等的内容时用sp_helptext或sp_help。
Visual Studio
(1)当安装vs2005时如果不能设置安装路径,其原因是需卸载vs的一些辅助组件,如Team Explorer等。其中Microsoft Visual Studio 2005 premier partner Edition是由于装Microsoft Visual Studio 2005 Team Explorer后出现的。
(2)重装Team Edition for Database Pros Add-on for Team Suite时, 要卸载下面的两个后再重装才能确保工程模版好用:
Microsoft Visual Stuido ProjectAggregator2
Microsoft Visual Studio 2005 Team Edition for Database Professionals - Trial - ENU
(3)用VS2005创建Infopath项目时候提示下面的错误:
英文的:
Package Load Failure.
Package 'ReportDesignerPackage' has failed to load properly (GUID={11B8C903-8FFD-4DFC-87CE-F6A82D77AF6B}).
Package 'DataWarehouse VSIntegration layer' has failed to load properly.
Package 'Microsoft Data Transformation Services Designer' has failed to load properly.
中文的:
包加载失败
未能正确加载包"ReportDesignerPackage"(GUID={11B8C903-8FFD-4DFC-87CE-F6A82D77AF6B})。请与包供应商联系以获得帮助。由于可能会发生环境损坏,建议重新启动应用程序。要禁止将来加载此包吗?可以使用"devenv/resetskippkgs"重新启用包加载。
原因可能是在VS2005中的Business Intelligence Projects模版丢失导致。
卸载并重装SQL Server 2005即可解决。
(4)
安装VS6.0时可能遇到下面的问题:
问题一:
scrrun.dll was unable to register itself in the system registry.
DiffMrg.ocx was unable to register itself in the system registry.
pdm.dll was unable to register itself in the system registry.
解决办法:
方法一:
将安装盘上VID98\BIN\下的DIFFMRG.OCX拷贝到c:\winnt\system32下,运行:regsvr32 c:\winnt\system32\DIFFMRG.OCX
方法二:
如果方法一不能注册成功。使用ProcessMonitor软件查看在注册这些dll时那些注册表是access denied。将不能访问的赋给当前用户管理员权限。
方法三:
如果还不能注册成功,直接给HKEY_CLASSES_ROOT赋予管理员权限。就能安装成功了。
问题二:
setup was unable to create a DCOM user account in order to register 'E:\Program Files\Microsoft Visual Studio\Common\Tools\VS-Ent98\Vanalyzr\VALEC.EXE'
解决办法:
微软承认的一个bug。安装时不安装Enterprise Tools-Options-Visual Studio Analyzer就可以解决这个问题了。
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q257413
--------
vs6.0安装问题
安装vs6.0 c++部分时候会遇到下面的几个提示:
1.Setup has installed an icon in the Microsoft Visual C++ 6.0 Tools program group, that will allow you to install a subset of the Windows NT system symbols (.DBG) files from your Visual C++ CD-ROM.
是让你到start-All Programs-Microsoft Visual Studio 6.0-Microsoft Visual Studio 6.0 Tools里安装Windows NT system symbols Setup
这个可能是用来c++调试NT系统函数时因为没有源代码而帮助用的。但我没装它。
2.javasign.dll was unable to register itself in the system registry
可能是因为你已经装了更新的Java所以不能注册。或者xp系统打了sp3而比vs6.0的新。有人说可以通过安装vs6.0 sp来解决,但我没有试验。
dll在"F:\Program Files\Microsoft Visual Studio\Common\IDE\IDE98\JAVASIGN123.DLL"
3.pdm.dll was unable to register itself in the system registry
执行regsvr32 "C:\Program Files\Common Files\Microsoft Shared\VS7Debug\pdm.dll"并通过使用Process Monitor跟踪注册表发现注册表的HKEY_CLASSES_ROOT\ProcessDebugManager.7没有权限访问,所以可以给权限后在注册这个dll来解决。
有人说可以装vs6.0 sp来解决。
但我没注册它。
----------------
我通过下面的方法在windows xp上安装成功了,先用ProcessMonitor查看到了那些没权限的注册表,然后给他们权限. 这样解决了除一个dll不成功之外的都成功注册.
HKEY_CLASSES_ROOT\Smart.DebugDocumentHelper
HKEY_CLASSES_ROOT\Smart.DebugDocumentHelper.1
HKEY_CLASSES_ROOT\Smart.DebugHelper
HKEY_CLASSES_ROOT\Smart.DebugHelper.1
HKEY_CLASSES_ROOT\XWeb.asp.4.0
HKEY_CLASSES_ROOT\.mpx
HKEY_CLASSES_ROOT\ProcessDebugManager
HKEY_CLASSES_ROOT\ProcessDebugManager.7
HKEY_CLASSES_ROOT\ProcessDebugManager.ProcessDebugManager
HKEY_CLASSES_ROOT\ProcessDebugManager.ProcessDebugManager.1
HKEY_CLASSES_ROOT\ProcessDebugManager.ThreadMgr
HKEY_CLASSES_ROOT\ProcessDebugManager.ThreadMgr.1
对于这个错误javasign.dll was unable to register itself in the system registry,我是通过下面的方法解决的.
http://www.dmcinfo.com/Blog/articleType/ArticleView/articleId/102/Installing-Visual-Studio-60-on-Windows-XP-or-Vista.aspx
然后所有安装成功.
H:\Visual Studio 6.0_USEnglish\Visual Studio Installer里面是安装的是Microsoft Visual Studio Installer,如果使用Visual Studio开发vb什么的就不用安装这个, 只需安装H:\Visual Studio 6.0_USEnglish\Ent\Disk1里的setup.exe
当完全安装成功后,我才能卸载它,我卸载成功了.但一些vs的小工具没卸载掉, 这些应该是单独的exe文件,直接删除就可以了,我留着没动它们.
5) 如果源代码不在Source Control下则右键工程选Go Online或Add Solution to Source Control,使文件在控制下。
C#
(1)C#:
using System;
using System.Collections.Generic;
using System.Text;
namespace ClassLibrary1
{
public class Class1
{
void fun()
{
//一维数组的定义
int[] a1;
a1 = new int[10];
//二维且每行元素个数相同的数组
int[,] a2 = new int[2, 3];
//二维且每行元素个数不相同的数组
int[][] a3 = new int[2][];
a3[0] = new int[5];
a3[1] = new int[2];
}
}
}
(2)
改.aspx文件时记住改.cs文件的类名和命名空间的名字,此时相应的.aspx文件中<%@ Page~~%>中的Inherits的值会相应改变,同时要改变此文件中Codebehind的值。<%@ Page Codebehind="Country.aspx.cs" %>是告诉asp.net引擎这个页面有个某某后置代码需要动态编译。
改Global.asax文件的命名空间名<%@ Page language="c#" Codebehind="MoveInConfirm.aspx.cs" AutoEventWireup="false" Inherits="Olympic.MaterialManage.Category1.MoveInConfirm" %><%@ Page language="c#" Codebehind="MoveInConfirm.aspx.cs" AutoEventWireup="false" Inherits="Olympic.MaterialManage.Category1.MoveInConfirm" %><%@ Page language="c#" Codebehind="MoveInConfirm.aspx.cs" AutoEventWireup="false" Inherits="Olympic.MaterialManage.Category1.MoveInConfirm" %><%@ Page language="c#" Codebehind="MoveInConfirm.aspx.cs" AutoEventWireup="false" Inherits="Olympic.MaterialManage.Category1.MoveInConfirm" %><%@ Page language="c#" Codebehind="MoveInConfirm.aspx.cs" AutoEventWireup="false" Inherits="Olympic.MaterialManage.Category1.MoveInConfirm" %>。
改web应用程序所在的目录名时,要右键Project名-Properties:General中的Assembly Name,Default Namespace,Web Settings中的Path值,其中Default Namespace对于VB.NET来说是根名字空间,对于C#是default namespace即如果没有命名空间就用默认的,有则就用已有的。
删掉.sln文件,打开.webinfo文件,将URLPath值改成.csproj文件的本地URL路径,打开.csproj文件-右键Solution选Rebuild生成.sln文件。
如有“CS1595: 已在多处定义~~”的错误,一般是因重命名了虚拟目录的名称和文件夹而造成的,则有2种方法:1.改掉所有命名空间名称2.删掉“C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files”目录下的此工程对应的文件(此时应进入任务管理器结束aspnet_wp.exe进程,才可以删掉此文件)再Rebuild再执行,如果还有错误就再删掉C:\Inetpub\wwwroot\OBFM\下的bin文件夹再Rebuild再执行,如果还有错误就再删掉c:\documents and settings\(username)\vswebcache
(3)aa/bb.xml路径是相对于上个页面的网站Virtual路径。
/aa/bb.xml是相对于webserver根的virtual path。
C:\Inetpub\wwwroot\aa\bb.xml是物理路径。
(4)服务器根目录要用“~/”
(5)将某个目录设成Virtual Directory时,其下面应该有.csproj等文件,不能在此目录下的子目录里。
(6)将某个目录设成Virtual Directory时,如用VS2003而又装了Framework2.0时,在Interent Information Services管理工具里右键其选properties-将其中的ASP.NET项下的Vertion值选对(VS2003选1.1.4322)。
(7)任何不在工程内的文件如图片文件,都可以通过拖动其到VS2003中来实现加入到工程里。
(8)对于VS2003中的.aspx文件中的表格等,不要在VS2003中拖动改变其大小,否则控制其大小的Width等属性会以style="width:30px"这种形式,如此时再在Dreamweaver中设置其值则造成重复,则页面不是你想要的。
当在VS2003中保存某个页面时,最好在Dreamweaver中使其页面处于激活状态,可避免使其在Dreamweaver中变成修改状态。
(9)将剪贴板上的字粘贴到.aspx文件里时,最好右键用Paste as HTML粘贴,这样得到的字是纯的前后不带样式标签的。
(10)在VS2003中的Solution Explorer视窗中点击“Show All Files”按钮会把后面的文件显示出来,再点一下又不显示。
(11)if(!IsPostBack)的IsPostBack的意义是“是否是第二次请求”。
(12)<%=Request.QueryString["~"] %>
Response.Write(Request.QueryString.Get("~"));
(13)在一个Project里使用另一个Project里的类时,要在References里通过Add Reference对话框里的Project栏里加此Project的bin\Debug里的.dll文件。
(14)Pet Shop4.0的安装只要象装软件一样装完就不用再按照它的Read me文件里说的手动安装了。选择完全安装时,会帮你自动建出4个数据库。
(15)C#编码规范:私有成员前加m,类和函数的注释用///,函数内部注释用//。
(16)如在写代码时候无智能提示则是因为在References里没有引入此组件即.dll的引用。
(17)当website项目没有.sln文件时候,可在VS2005里选file-open-web site之后选此项目的总文件夹就可以打开了。之后可以在file下拉菜单中保存一个.sln文件。
(18)启动用户实例的进程时出错
问题:
使用ASP.NET 2.0 + SQL2005 + aspnetdb(MemberShip等功能)时出现这个问题:
“由于启动用户实例的进程时出错,导致无法生成 SQL Server 的用户实例。该连接将关闭。”
英文是:“Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed.”
问题原因:
这是微软的bug,并且微软已经承认,详情如下:http://support.microsoft.com/?id=896613
出现此错误的条件是:你用过远程桌面连接,并且安装了SQL2005+VS2005,就有很大可能触发这个问题,微软说会在将来的XP SP3里面解决掉这个问题。
解决:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=128707&SiteID=1
如果你看不懂英文,那么我告诉你我的解决办法:
删除C:\Documents and Settings\[USERNAME]\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\SQLEXPRESS目录即可,[USERNAME]是Windows用户名,比如说Administrator
(19)从客户端调用Web Method时发生[Method Error 12031]或[Method Error 500]异常:
若要从客户端调用某个服务器端Web Service中的Web Method,则该Web Service必须拥有Microsoft.Web.Script.Services.ScriptServiceAttribute属性:
//如果你装的是ASP.NET AJAX(Atlas)Beta 1则加下面的属性
[Microsoft.Web.Script.Services.ScriptService()]
//如果你装的是ASP.NET AJAX(Atlas)v1.0则加下面的属性
[System.Web.Script.Services.ScriptService]
public class MyService : System.Web.Services.WebService
{
//
}
若要从客户端调用某个定义与页面中的Page Method,则该Page Method必须用Microsoft.Web.Script.Services.ScriptMethodAttribute属性修饰(当然,System.Web.Services.WebMethod也是必不可少的),且必须为静态(static)方法。目前版本的一个Bug还导致我们必须在ASPX文件中定义这个Web Method,在CS文件中定义是没有作用的(真是无奈):
//如果你装的是ASP.NET AJAX(Atlas)Beta 1则代码只能写成下面的混合模式
<script runat="server">
[System.Web.Services.WebMethod]
//如果你装的是ASP.NET AJAX(Atlas)Beta 1则加下面的属性
[Microsoft.Web.Script.Services.ScriptMethod]
//如果你装的是ASP.NET AJAX(Atlas)v1.0则加下面的属性
[System.Web.Script.Services.ScriptMethod]
public static string GetHtml(string contextKey)
{
//
}
</script>
//如果你装的是ASP.NET AJAX(Atlas)v1.0则代码可以分离着写
[WebMethod]
[System.Web.Script.Services.ScriptMethod]
public static CascadingDropDownNameValue[] GetArea(string knownCategoryValues, string category)
{
//
}
(20)关于String的解释:
1.给字符串变量赋值时是新建一个字符串对象,而不是修改此字符串变量原来指向的字符串对象。
2.DotNet 有字符串驻留机制:CLR内部有一张哈希表用来保存应用程序域的所有字符串;如果新创建一个字符串,如果在hash表中找到和这个字符串相同的值,那么返回相同的地址,如果不相同那么在hash表中新增一条记录。
3.不能修改字符串对象实例的值,而 StringBuilder 则是在原对象实例基础上的修改。
4.rel可以把参数的数值传递进函数,但是out是要把参数清空,就是说你无法把一个数值从out传递进去的,out进去后,参数的数值为空,所以你必须初始化一次。这个就是两个的区别,或者说就像有的网友说的,rel是有进有出,out是只出不进。
也有的人说:
ref是传入值,out是传出值。
ref侧重修改,out侧重输出。
ref是传递参数的地址。
(20)C#中out与ref的用法与区别
1、out必须在函数体内初始化,在外面初始化没意义。也就是说,out型的参数在函数体内不能得到外面传进来的初始值。
2、ref必段在函数体外初始化。
3、两都在函数体的任何修改都将影响到外面。
例:
using System;
namespace ConsoleApplication1
{
class C
{
public static void reffun(ref string str)
{
str += " fun";
}
public static void outfun(out string str)
{
str = "test"; //必须在函数体内初始
str += " fun";
}
}
class Class1
{
[STAThread]
static void Main(string[] args)
{
string test1 = "test";
string test2; //没有初始
C.reffun( ref test1 ); //正确
C.reffun( ref test2 ); //错误,没有赋值使用了test2
C.outfun( out test1 ); //正确,但值test传进去
C.outfun( out test2 ); //正确
Console.Read();
}
}
}
在传值和传址情况下,C#强制要求参数在传入之前由用户明确初始化,否则编译器报错!但我们如果有一个并不依赖于参数初值的函数,我们只是需要函数返回时得到它的值是该怎么办呢?往往在我们的函数返回值不至一个时我们特别需要这种技巧。答案是用out修饰的输出参数。但需要记住输出参数与通常的函数返回值有一定的区别:函数返回值往往存在堆栈里,在返回时弹出;而输出参数需要用户预先制定存储位置,也就是用户需要提前声明变量--当然也可以初始化。
在函数体内所有输出参数必须被赋值,否则编译器报错!out修饰符同样应该应用在函数声明和调用两个地方,除了充当返回值这一特殊的功能外,out修饰符ref修饰符有很相似的地方:传址。
(21)数组参数的例子:
using System;
class Test
{
static int Sum(params int[] args)
{
int s = 0;
foreach (int n in args)
{
s += n;
}
return s;
}
static void Main()
{
int[] var = new int[] { 1, 2, 3, 4, 5 };
Console.WriteLine("The Sum:" + Sum(var));
Console.WriteLine("The Sum:" + Sum(10, 20, 30, 40, 50));
}
}
(22)GradView等控件的OnObjectCreated事件在第一次调用odsOrg3_ObjectCreated(object sender, ObjectDataSourceEventArgs e)函数时是创建表头。
(23)要想取得控件里面的控件的ID号如GradView里的模板列的,应该这样取:GradView$TemplateField。
(24)asp的控件的html端的ID如在Javascript里用其ID,可以这样得到<%=其服务器端ID.ClientID %>
(25).aspx中:<iframe id="content" runat="server" frameborder="0" style="width: 100%; height: 100%;"></iframe>
.cs中可以这样使用:((System.Web.UI.HtmlControls.HtmlGenericControl)content).Attributes["src"] = "aaa";
(26)在C#中switch的比对参数也可以是字符串:
switch (Request.QueryString["tem"])
{
case "ab":
addr = "aa.aspx";
break;
}
(27)这个<style type="text/css"></style>要放在<head runat="server"></head>中否则看不了设计视图。
(28)Javascript里也可以用else if(),如
if(1)
{}
else if(0)
{}
(30)
using System;
using System.Collections.Generic;
using System.Text;
namespace OBFM.BusinessRules
{
[System.ComponentModel.DataObject]
public partial class BumpInBO
{
[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, false)]
public DataSetBumpIn.BumpInDocumentDataTable GetDocByDocId(string docId)
{
return BumpInDocAdapter.GetDocByDocId(docId);
}
}
}
上面的类和方法加的属性可以使在页面中配置ObjectDataSource数据源时既选Configure Data Source-Choose a Business Object里看到此类,在Define Data Methods中可以看到此方法。
(31)强类型的Dataset指系统建立的带外键关系等结构,很象数据库中的表结构的Dataset,而我们自己new的Dataset只加了colume等而没有结构关系的是非强类型的。
(32)如果Dataset视图中有多个表,那么此Dataset结构是有的只是是没有数据的空结构,通过下面的方法可以使一个Dataset中的某些表充满数据:
DataSetSystem dsRole = new DataSetSystem();
OBFM.DataEntities.DataSetSystemTableAdapters.PathTableAdapter pathTableAdapter = new OBFM.DataEntities.DataSetSystemTableAdapters.PathTableAdapter();
pathTableAdapter.Fill(dsRole.Path);
OBFM.DataEntities.DataSetSystemTableAdapters.RolePathTableAdapter rolePathTableAdapter = new OBFM.DataEntities.DataSetSystemTableAdapters.RolePathTableAdapter();
rolePathTableAdapter.FillByRoleId(dsRole.RolePath, Int32.Parse(gvRole.SelectedValue.ToString()));
上面的Dataset“dsRole”中就有了两个充满值的表。
(33)如果想给Dataset.xsd中的某个适配器类增加方法,可以右键.xsd选择View Code之后下面出现.cs文件,可以在此文件里扩展~TableAdapter类的方法。
(34)如果用<asp:ObjectDataSource/>作为数据源,查询语句的参数来自于<asp:ObjectDataSource/>监视的<asp:TextBox/>,那么当文本框为空时,虽然this.TextBoxID.Text的值为"",但SQL语句要用@~ is null对应。
如果用:
DepartmentTableAdapter departmentAdapter = new DepartmentTableAdapter();
Department.DepartmentDataTable aa = departmentAdapter.GetDataByPara("dscpn", this.txtSearchKey.Text);
this.gvOrg.DataSource = aa;
做数据源,那么传给SQL语句的值为"",所以要在SQL语句中用@~ = ''对应。
(35)在.aspx文件的
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
前面最好加上<script type="text/javascript"></script>,可使设计时见到的页面和浏览时看到的一样。
(36)http://jsjlcl.bokee.com/viewdiary.13765974.html Cookie的基本知识
(37)作安装程序时可设置的地方:
1.左键点击Setup工程-在属性窗中:
Author:JasonLi
Localization:Chinese(Simplified)
Manufacturer:
ProductName:将显示在安装对话框中
RemovePreviousVersions:True
Title:
2.右键点击Setup工程-View-File System-点击编辑窗中的Web Application Folder-在属性窗中:
VirtualDirectory:
3.右键点击Setup工程-View-User Interface-点击编辑窗中的Welcome-在属性窗中将WelcomeText改为“制作:~-~-安装程序将引导您完成在您的计算机上安装<[ProductName]>所需的步骤。”
如果是用WebSetup做个只有合并模块的安装程序则可以删掉编辑窗中的“Installation Address”
4.右键Setup工程-Properties-可在Output file name中修改生成后的.msi文件的名称如改为SetupEXT.msi
可点击Prerequisites在对话框中选预安装的东西,VS2005会将你选的东西做到你的安装程序里,在安装的时候会预先从你的安装程序里安装这些组件。记住如果改属性时候要改完debug模式后也要把release模式下的属性改成一样的。
5.右键Setup工程或右键File System里的东西都会有Add选项来添加东西。
(38)ASP.NET Error: Failed to access IIS metabase错误的解决办法
错误提示:
Server Error in '/PSP' Application.
Failed to access IIS metabase.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.Hosting.HostingEnvironmentException: Failed to access IIS metabase.
The process account used to run ASP.NET must have read access to the IIS metabase (e.g. IIS://servername/W3SVC). For information on modifying metabase permissions, please see http://support.microsoft.com/?kbid=267904.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. |
Stack Trace:
[HostingEnvironmentException: Failed to access IIS metabase.]
System.Web.Configuration.MetabaseServerConfig.MapPathCaching(String siteID, VirtualPath path) +3500410
System.Web.Configuration.MetabaseServerConfig.System.Web.Configuration.IConfigMapPath.MapPath(String siteID, VirtualPath vpath) +9
System.Web.Hosting.HostingEnvironment.MapPathActual(VirtualPath virtualPath, Boolean permitNull) +163
System.Web.CachedPathData.GetConfigPathData(String configPath) +382
System.Web.CachedPathData.GetConfigPathData(String configPath) +243
System.Web.CachedPathData.GetApplicationPathData() +68
System.Web.CachedPathData.GetVirtualPathData(VirtualPath virtualPath, Boolean permitPathsOutsideApp) +3393731
System.Web.Configuration.RuntimeConfig.GetLKGRuntimeConfig(VirtualPath path) +189
|
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210
解决方法:
1.在run里运行cmd命令进入DOS命令行-cd \-cd C:\windows\microsoft.net\framework\v2.0.50727或在Microsoft Visul Studio 2005-Visul Studio Tool里调出Visual Studio 2005 Command Prompt后直接输入命令而不用退到C:\windows\microsoft.net\framework\v2.0.50727这个目录。
2.然后执行命令 aspnet_regiis -ga <账户名>
3.aspnet_regiis -i -enable
4.net stop iisadmin
5.net start w3svc
对了说一下,aspnet_regiis.exe这个程序是在c:\windows\microsoft.net\framework\v2.0.50727目录下的,如果你的不是windows xp sp2,那么请您搜寻该程序,只要执行相同的命令即可。
(39)“VSTS 启动web测试记录器无效”问题的解决
现象:
用VS2005做性能测试时,发现添加新的web测试,启用记录web动作,发现web记录器的按钮都是灰显的,只是web浏览器左面提示要从vs内部打开web记录器。
原因:
在微软的论坛中发现这个可能是个Bug,相关帖子http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=572411&SiteId=1
解决:
办法1:安装Visual Studio 2005 Service Pack 1 (SP1)即VS80sp1-KB926601-X86-ENU下载地址http://msdn2.microsoft.com/en-us/vstudio/bb265237.aspx 安装完后要重启才能起作用
办法2:使用工具Fiddler录制脚本,可以录制后保存为后缀为.webtest的文件,然后导入项目中。下载地址http://www.fiddlertool.com/fiddler/
办法3:可以通过重新注册插件恢复,但这种方法可能不起作用,打开记事本输入内容如下:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\CLSID\{8C84B9F5-3D9E-4204-BB0B-F85D46455868}]
@="Web Test Recorder"
"MenuText"="Web Test Recorder"
"HelpText"="Record Web Tests."
[HKEY_CLASSES_ROOT\CLSID\{8C84B9F5-3D9E-4204-BB0B-F85D46455868}\Implemented Categories]
[HKEY_CLASSES_ROOT\CLSID\{8C84B9F5-3D9E-4204-BB0B-F85D46455868}\Implemented Categories\{00021493-0000-0000-C000-000000000046}]
[HKEY_CLASSES_ROOT\CLSID\{8C84B9F5-3D9E-4204-BB0B-F85D46455868}\Implemented Categories\{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}]
[HKEY_CLASSES_ROOT\CLSID\{8C84B9F5-3D9E-4204-BB0B-F85D46455868}\InprocServer32]
@="mscoree.dll"
"ThreadingModel"="Both"
"Class"="Microsoft.VisualStudio.TestTools.WebTest.RecorderBarControl"
"Assembly"="Microsoft.VisualStudio.QualityTools.RecorderBar, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
[HKEY_CLASSES_ROOT\CLSID\{8C84B9F5-3D9E-4204-BB0B-F85D46455868}\InprocServer32\8.0.0.0]
"Class"="Microsoft.VisualStudio.TestTools.WebTest.RecorderBarControl"
"Assembly"="Microsoft.VisualStudio.QualityTools.RecorderBar, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Explorer Bars\{8C84B9F5-3D9E-4204-BB0B-F85D46455868}]
"BarSize"=hex:06,01,00,00,00,00,00,00
然后保存为.reg文件,并双击植入注册表
部分原文内容http://www.cnblogs.com/oscarxie/archive/2007/01/11/618150.html
(40)
现象:
The specified display mode is currently disabled on this page. Make sure personalization is enabled for the current user.
Parameter name: value
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: The specified display mode is currently disabled on this page. Make sure personalization is enabled for the current user.
Parameter name: value
原因:
除Browse模式外其他模式都需要认证才能使用。
WebPart与Membership是有联系的,在DesignMode下需要认证的用户才能访问,如果用户没有登陆,那么会出现上面的提示.而微软说没有认证的用户也可以使用DesignMode,但是一切的改变只会存储在ViewState中。
解决办法:
1.在切换模式时让用户先登陆
2.在登入的地方加上:
FormsAuthentication.RedirectFromLoginPage(userid, false);
并且修改web.config如下:
<authentication mode="Forms"/>
3.如果想让没有被认证的用户也可以使用其他模式,可以通过加上下面的代码实现:
C#
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
HttpCookie authCookie = Request.Cookies.Get(FormsAuthentication.FormsCookieName);
if (authCookie == null)
{
String MyCookieName = "Reminder";
System.Web.HttpCookie MyCookie = Request.Cookies.Get(MyCookieName);
String UserID;
if (MyCookie == null)
{
UserID = System.Guid.NewGuid().ToString().Replace("-", "");
MyCookie = new System.Web.HttpCookie(MyCookieName, UserID);
MyCookie.Expires = DateTime.Now.AddYears(10);
Response.Cookies.Add(MyCookie);
}
else
{
UserID = MyCookie.Value;
}
FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(1, UserID, DateTime.Now, DateTime.Now.AddSeconds(30), false, "roles");
String encryptedTicket = FormsAuthentication.Encrypt(authTicket);
authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
Response.Cookies.Add(authCookie);
Response.Redirect(Request.Url.ToString());
}
System.DateTime LastDate = System.DateTime.Now.AddYears(-1);
System.Data.SqlClient.SqlConnection cnn = new System.Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings["LocalSqlServer"].ConnectionString);
System.Data.SqlClient.SqlCommand cmd;
cmd = new System.Data.SqlClient.SqlCommand("DELETE FROM" + " aspnet_PersonalizationPerUser where UserID IN " + "(SELECT UserID from aspnet_Users where " + "[LastActivityDate] < @Date)", cnn);
cmd.Parameters.Add("@Date", SqlDbType.DateTime);
cmd.Parameters["@Date"].Value = LastDate;
try
{
cnn.Open();
cmd.ExecuteNonQuery();
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
finally
{
cnn.Close();
}
cmd = new System.Data.SqlClient.SqlCommand("DELETE FROM" + " aspnet_Users where [LastActivityDate] < @Date", cnn);
cmd.Parameters.Add("@Date", SqlDbType.DateTime);
cmd.Parameters["@Date"].Value = LastDate;
try
{
cnn.Open();
cmd.ExecuteNonQuery();
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
finally
{
cnn.Close();
cmd.Dispose();
cnn.Dispose();
}
}
}
VB.NET代码:
http://www.codeproject.com/aspnet/anonywebparts.asp
(41)
网页中调用qq和msn
调用qq的方法:
<A href="tencent://message/?uin=20989163&Site=博客园&Menu=yes"
target=blank><IMG alt=点击这里给我发消息 src="http://wpa.qq.com/pa?p=1:20989163:11"
border=0></A>
调用msn的方法:
<A href="msnim:chat?contact=xxqq0824@hotmail.com" target=blank>点这里和我MSN聊天</A>
放在页面上就能出效果了!
还要补充一点,如果你想要自定义的话,可以访问:
http://is.qq.com/cgi-bin/webpresence/wpa_code;在这里可以设置你的qq的图片,以及一些附加功能。
QQ:
<a target=blank href=tencent://message/?uin=QQ号&Site=网站名称&Menu=yes><img border="0" SRC=http://wpa.qq.com/pa?p=1:QQ号:7 alt="点击这里给我发消息">
MSN:
<A href="msnim:chat?contact=lyjier@hotmail.com" target=blank>点这里和我MSN聊天</A>
网页调用MSN功能
在新添加的功能中,还包括可通过网页中的链接添加联系人、开始交谈、开始视频交谈和开始语音交谈。链接的构造如下:
开始交谈:msnim:chat?contact=contact@hotmail.com
添加联系人:msnim:add?contact=contact@hotmail.com
启动一个语音聊天:msnim:voice?contact=contact@hotmail.com
启动一个视频聊天:msnim:video?contact=contact@hotmail.com
建立对话:msnim:chat?contact=[MSN ID]
添加好友:msnim:add?contact=[MSN ID]
语音聊天:msnim:voice?contact=[MSN ID]
视频聊天:msnim:video?contact=[MSN ID]
只要把以上的代码作为链接放入<a href="">中的引号里面,就可以了。。。。
网页调用msn对话框
<Script language=javascript>
function SendMSNMessage(name)
{
//MyStatus == 1 本地MSN未登录
//MyStatus == 2 本地MSN已登录
if(MsgrObj.MyStatus == 1){
alert("Please login your MSN Messenger!");
}else{
MsgrObj.InstantMessage(name);
}
}
function AddMSNContact(name)
{
MsgrObj.AddContact(0, name);
}
</script>
<object id="MsgrObj" classid="clsid:B69003B3-C55E-4B48-836C-BC5946FC3B28" codetype="application/x-oleobject" width="0" height="0"></object>
<a href="javascript:SendMSNMessage('name@hotmail.com')">msn_test</a>
(42)怎样使用#if test #endif:
先在“Configuration Manager”里New一个"Conditional compilation symbols", 之后在Project Properties里的Build项里的"Conditional compilation symbols"内输入刚刚新建的那个符号,之后在代码中的#if test #endif中使用这个符号就可以实现条件编译了。
(43)如果website不能通过vs打开可以尝试下面的方法:
1.如果是vs2003项目则要在IIS上创建此站点
2.确信ContentGroupManagement.sln文件能的路径是IIS上此站点的的虚拟路径(不用修改ContentGroupManagement.vbproj.webinfo文件的信息,因为.sln文件会更新.webinfo文件)
3.在vs里右键此项目选择reload
4.如果还不能打开,则单独打开此project,不要通过.sln,如果成功后再reload
5.如果Browse此站点时,报下面的错误:
Server Error in '/ContentGroupManagement' Application.
--------------------------------------------------------------------------------
Server cannot access application directory 'C:\Documents and Settings\jason_li\Desktop\MS@WorkoldWeb\MSAtWork\ContentGroupManagement\'. The directory does not exist or is not accessible because of security settings.
则可能是你把代码放到了桌面上。
6.如果在代码中使用System.Net.WebClient.OpenRead(webserviceUrl)打开webservice抛出异常可以到IIS上,右键站点选“Properties”-“Document”中添加CGManagement.asmx并将其设置成默认主页,右键选“Browse”核实是否能浏览成功。
7.如果报“没权限访问”的错误,可右键站点选“Properties”-“Directory Security”-勾选“Enable anonymous access”。
(44)Copy Local 属性:确定是否将引用复制到本地 bin 路径。在运行时,引用必须位于全局程序集缓存 (GAC) 或项目的输出路径中。如果将该属性设置为 true,则在运行时将把引用复制到项目的输出路径。
部署/复制包含对自定义组件(该组件在 GAC 中注册)的引用的应用程序时,无论 Copy Local 的设置如何,组件都不会与应用程序一起部署/复制。
http://msdn.microsoft.com/zh-cn/library/t1zz5y8c.aspx
(45)\r\n与\n的区别
\r 是回车,return
\n 是换行,newline
我们在平时使用电脑时,已经习惯了回车和换行一次搞定,敲一个回车键,即是回车,又是换行,但在早期的打字机上,要另起一行打字需要两个步骤,首先要发送命令"\r”将打字头复位,即回车,然后再发送命令"\n”让打字机走纸移到下一行,所以这个历史遗留问题导致了如今我们在DOS-Windows的系统里需要区分"\r\n”和“\n”,但在Unix中只有"\n”。
用UltraEdit打开文本查看,会看到换行处显示的是0x0D0A,0x0D即"\r”,0x0A即"\n”。
有时候在文本文件中出现■这样的符号,是因为没有"\r\n"连用,导致不能正确回车换行。
在C中读取文本时,"\r\n”已自动转成"\n”。
\r 就是return 回到本行行首.
\n 换到下一行.
\r\n与\n用起来应该都没有区别,有些编辑器它不认\n,如果要通用的则是\r\n.
(46)反射
http://hi.baidu.com/wangjunwangjuna/blog/item/b7873b2abc0594315243c15e.html
(47)c#接口和抽象类的区别
http://www.cnblogs.com/zhangzheny/archive/2007/12/24/1012790.html
C#接口和抽象类的经典示例与比对
http://developer.51cto.com/art/200908/144116.htm
接口继承

代码
public interface Interface1
{
void PayIn(decimal amount);
bool Withdraw(decimal amount);
decimal Balance
{
get;
}
}
public interface Interface2 : Interface1
{
bool TransferTo(Interface1 destination, decimal amount);
}
实现接口中方法签名的实际方法,可以是虚的,也可以不是虚的

代码
interface IA
{
void M();
void M1();
}
class A : IA
{
public virtual void M()
{
Console.WriteLine("A.M ");
}
public void M1()
{
Console.WriteLine("A.M1 ");
}
}
class B : A
{
public override void M()
{
Console.WriteLine("B.M ");
}
public new void M1()
{
Console.WriteLine("B.M1 ");
}
}
class C : A, IA
{
public override void M()
{
Console.WriteLine("C.M ");
}
public new void M1()
{
Console.WriteLine("C.M1 ");
}
}
public class DemoApp
{
public static void Main()
{
B b = new B();
C c = new C();
A ab = b;
A ac = c;
IA iab = b;
IA iac = c;
// 用A的引用来调用
ab.M();
ac.M();
ab.M1();
ac.M1();
// 用IA接口的引用来调用
iab.M();
iac.M();
iab.M1();
iac.M1();
}
}
结果如下:
B.M // ab.M();
C.M // ac.M();
A.M1 // ab.M1();
A.M1 // ac.M1();
B.M // iab.M();
C.M // iac.M();
A.M1 // iab.M1();
C.M1 // iac.M1();
注意iab.M1()的结果和iac.M1()的结果。
iab.M1()的调用很好理解,因为M1不是虚的,所以调用了A中定义的方法。
但是iac.M1却实际执行了C中的实现。这是为什么呢?
我们来看一下.Net中的System.Type这个类。它有一个方法:
public virtual InterfaceMapping GetInterfaceMap (Type interfaceType)
在返回的InterfaceMapping中有一个InterfaceMehotds字段和一个TargeMethods字段。这就给了我们一些提示,可以想象,当使用接口进行调用时,一定在幕后查找了接口对应关系表,从而找到应该实际调用哪个方法实现。这种想象至少在逻辑上是合理的,但不一定是通过InterfaceMapping来实现的,这涉及到.Net Runtime是如何写的问题。有了这张表,上面的结果就很自然了。因为B并没有声明实现IA接口,它是继承A的实现,所以InterfaceMapping里面的对应关系自然记载的是A的实现了。而C就不然,它直接声明为实现了IA,所以InterfaceMapping里面记载的是C的实现。从而调用的时候执行的是C的代码,好像和virtual/override的行为差不多,但其实完全不一样。一个是通过类本身的虚方法表进行查找;一个是通过InterfaceMapping进行查找。
说了这么多,到底能说明什么问题呢?
使用interface,实际上也能提供不同于继承的方法覆盖(virtual/override)的实现多态的手段。但了解它们的区别还是有些用处的。一个直接能想到的启示是“我们在编程的时候如果是调用接口的方法,最好显示地使用接口的引用来进行调用。”因为一般我们都希望这种多态性能工作。如果不使用接口进行调用,就可能会无法获得这种多态性。尽管有时候我们确实希望调用基类中的方法,但这并不常见。
48)
设计模式的形象比喻
http://baike.baidu.com/view/66964.htm?fr=ala0_1
ASP.NET
(1)ASP.NET数据控件的区别:
<!--GridView:格式控制到列,并迭代-->
<table cellspacing="0" rules="all" border="1" id="GridView1" style="border-collapse: collapse;">
<tr>
<td>
aa
</td>
<td>
1
</td>
</tr>
</table>
<!--DetailView:格式控制到列,但不迭代-->
<table cellspacing="0" rules="all" border="1" id="DetailsView1" style="height: 50px;
width: 125px; border-collapse: collapse;">
<tr>
<td>
Person
</td>
<td>
aa
</td>
</tr>
</table>
<!--DataList:格式控制到行,并迭代-->
<table id="DataList1" cellspacing="0" border="0" style="border-collapse: collapse;">
<tr>
<td>
aa
</td>
</tr>
</table>
<!--FormView:格式控制到行,但不迭代-->
<table cellspacing="0" border="0" id="FormView1" style="border-collapse: collapse;">
<tr>
<td colspan="2">
Person
</td>
</tr>
</table>
<!--Repeater:不控制格式,迭代-->
(2)授权管理AzMan
http://www.cnblogs.com/AndyGe/archive/2009/08/13/1545199.html
(3)安全套接层SSL和证书简介:
http://www.hudong.com/wiki/%E5%AE%89%E5%85%A8%E5%A5%97%E6%8E%A5%E5%AD%97%E5%B1%82%28SSL%29#1
请记住,SSL 连接始终包含身份验证,其中客户端验证服务器的身份。特别是客户端将验证服务器是否具有有效证书,例如证书是否过期、是否被注销、是否由客户端信任的证书颁发机构颁发等。
SSL中的服务器身份验证
常见错误是在SSL连接中使用localhost或服务器主机名的其它别名。在SSL握手期间,客户端验证服务器证书主题名称的公用名称(CN)部分与HTTP请求中的主机名是否匹配。如果不匹配,SSL连接将失败。客户端还同时验证服务器端证书是否有效、是否撤消以及是否由信任的CA颁发。
客户端证书身份验证
除了必要的服务器身份验证,SSL还有一个可选步骤:对客户端进行身份验证。这是使用客户端证书进行的。客户端证书与服务器证书相似。如果服务器配置为要求客户端证书,客户端会将客户端证书发送到服务器。服务器至少要检查它是否信任此客户端证书,例如,它是否由信任的证书颁发机构颁发。
SSL是工作在公共密钥和私人密钥基础上的,任何用户都可以获得公共密钥来加密数据,但解密数据必须要通过相应的私人密钥。使用SSL安全机制时,首先客户端与服务器建立连接,服务器把它的数字证书与公共密钥一并发送给客户端,客户端随机生成会话密钥,用从服务器得到的公共密钥对会话密钥进行加密,并把会话密钥在网络上传递给服务器,而会话密钥只有在服务器端用私人密钥才能解密,这样,客户端和服务器端就建立了一个惟一的安全通道。
http://www.51cto.com/art/200512/12821.htm
http://zhangxk621.blog.163.com/blog/static/88208822009614101349374/
3 客户端证书的获得与安装
客户端如果想通过信息安全通道访问需要安全认证的网站,必须具有此网站信任的CA机构颁发的客户端证书以及CA认证机构的证书链。下面看一下如何申请客户端证书。
3.1 申请客户端证书
3.1.1打开IE浏览器,在地址栏中输入http://ca/认证服务器名称/CertSrv然后回车;
3.1.2选择”申请证书”,单击”下一步”,然后选择”用户证书”,单击”下一步”;
3.1.3在如下图页面中,对客户证书作更加详细的定制,然后单击“提交”;
3.1.4服务器根据用户的请求生成一个客户端证书,并且作为一个ActiveX控件嵌入回应的网页里面,用户只要单击“安装此证书”就可以了。
3.2 安装证书链或CRL
CA认证机构的证书链好比是一个证书的路径,浏览器通过这个路径能够找到客户端证书,并且检验用户证书的合法性,因此必须要在客户端安装CA认证机构的证书链。
3.2.1在浏览器中输入http://ca/认证服务器名称/CertSrv/default.asp,载入CA认证中心页面,单击“下载一个CA证书,证书链或CRL”
3.2.2选择安装“此证书链”
4 通过安全信息通道访问WEB网站
客户端安装了证书和证书链后,我们就可以访问需要客户端认证的网站了,但是必须保证客户端证书和服务器端证书是同一个CA颁发的。我们在浏览器中输入以下网址https://WEB服务器地址:SSL端口 /index.htm,其中https表示浏览器要通过安全信息通道(即ssl,安全套接层)访问web站点,并且如果服务器的SSL端口不是默认的443端口那么在访问的时候要指明SSL端口。在连接刚建立时浏览器会弹出一个安全警报对话框,这是浏览器在建立SSL通道之前对服务器端证书的分析,用户单击“确定”以后,浏览器把客户端目前已有的用户证书全部列出来(如下图所示),供用户选择,选择正确的证书后单击“确定”,至此安全通道正式建立。
5 为什么通过安全信息通道来访问WEB站点
目前,internet上的绝大部分信息是明文传送的,用户的各种敏感信息通过某些嗅探软件(如snort)都可以轻而易举的得到,网络用户没有办法保护自己的合法权益,网络不能充分发挥其方便快捷安全高效的效能,阻碍了我国电子商务,电子政务的建设,阻碍了B/S系统软件的推广。
我们通过研究国外的各种网络安全解决方案,认为采用最新的SSL(安全套接层)技术来构建安全信息通道是一种在安全性,稳定性,可靠性的方面考虑都很优秀的解决方案。
在IIS中启用安全通道ssl,如何使用客户端证书
在Web的安全通信属性设置中,不同的配置选项会对客户端有不同的要求:
如果不选择“申请安全通道(SSL)”,则允许客户端可以选择是否使用SSL加密传输,即:使用加密方式访问“https://120.10.10.11”或不加密方式访问“http://120.10.10.11”可以由客户端自己选择。如果选择了“申请安全通道(SSL)”,则要求客户端必须使用SSL加密传输,即必须使用https://120.10.10.11/的形式。选择“申请128位加密”,要求客户端的浏览器必须支持128位的加密强度。建议不要选择该项,因为一般的浏览器支持的是56位的加密强度,而且系统帮助文件里提到128位加密技术只限制在美国本土和加拿大使用,不向其他国家出口。
当Web服务器的安全通信属性配置为“申请安全通道(SSL)”和“申请客户证书”后,客户端以https的形式访问该Web时会被提醒需要选择一个已经安装的客户证书,如果没有客户证书或者没有服务器信任的客户证书,都不能访问。客户证书是服务器判断客户端是否可信任的依据,用来防止不被信任的客户端访问该服务器。申请和安装客户证书的具体步骤为:打开IE,在地址栏输入“http://120.10.10.11∶85”/ 并确认,根据网页的提示单击“下一步”按钮逐步完成申请。申请过程中分别选择:申请证书→用户证书申请(选择“Web浏览器证书”)→输入在证书中出现的标识信息(至少要输入名称)→您申请的证书已发布给您(点击“安装此证书”)→您的新证书已经成功安装。当用IE再一次访问Web服务器时会弹出“客户身份验证窗口”,在该窗口内选择刚才安装的客户证书,然后确认,就可以正常访问服务器了。
应用SSL传输网上信息后,可以保证信息的安全,但是网站的速度会受影响,因为加密是需要花时间的。本文所讲述的例子是将整个站点都配置为要求SSL传输,也就是说访问的所有文件都是加密传输的,实践中建议SSL安全传输只使用在一些关键信息的传输上,比如验证用户名、密码(口令)或其他需要保密的信息等,一般的信息可以正常传输,这样分配后网站速度几乎不受影响。
可以参照此连接的内容,用makecert自己做个证书,用httpcfg绑定证书到某个IP。
http://www.cnblogs.com/frank_xl/archive/2009/08/13/1543848.html
http://blog.csdn.net/kwanhong/archive/2006/09/28/1301439.aspx
http://msdn.microsoft.com/en-us/library/ms733791.aspx
http://technet.microsoft.com/en-us/library/cc787508(WS.10).aspx
1.制作自签名证书:
C:\Program Files\Microsoft Visual Studio 8\VC>makecert -sr localmachine -ss My -
n CN=JasonFrontier -sky exchange -pe -r
2.使用MMC查看证书:开始--运行--MMC--控制台--添加删除单元--证书--查看LocalMachine的Person中证书。
3.右键站点选属性,到Directory Security选Server Certificate点下一步后,选Assign an existing certificate,然后给SSL设置端口号,就可以给站点加上证书和SSL了。在IE中用https+SSL端口就可以访问站点了,当访问时候会提示证书有问题(提示:不是由证书机构发的,或站点URL和证书名不匹配),不用管它,选继续就可以访问了。
下面用于WPF不使用给站点加证书和SSL。
3获得新创建的证书的hash码
C:\Documents and Settings\v-jasl>certutil -store "my" "JasonFrontier"
4绑定证书到IP及端口,注意此端口是将来的SSL端口,不是现在的TCP端口
C:\Documents and Settings\v-jasl>"C:\Documents and Settings\v-jasl\Desktop\http
fg.exe" set ssl -i 10.192.73.85:8889 -h e39526e309e91204384b8e516efc36117cd0f8e
5查看绑定结果
C:\Documents and Settings\v-jasl>"C:\Documents and Settings\v-jasl\Desktop\http
fg.exe" query ssl
6删除SSL证书绑定
C:\Documents and Settings\v-jasl>"C:\Documents and Settings\v-jasl\Desktop\http
fg.exe" delete ssl -i 10.192.73.85:8889 -h e39526e309e91204384b8e516efc36117cd0
8ea
(4)网页插件-windows窗体控件
http://blog.csdn.net/zhzuo/archive/2004/05/10/22032.aspx
(5)
((System.Data.DataRowView)(e.Row.DataItem)).Row.ItemArray[7] 是数据库返回的数据集合,从中去某项。
e.Row.Cells[7] 在UI上的Gridview的当前行的所有cell的数据集合。
e.Row.Controls[7] 当前行中的所有控件,包括数据DataItem和控件如HyperLink 。
e.Row.Controls[7].Controls[0] 除去数据控件外的真正的控件。
<%#DataBinder.Eval(Container, "DataItem.ConfirmationNo") %> 控件绑定数据库返回的数据集合中的某项。
<%=UserAlias%> Aspx页面中写C#代码,此代码和.cs文件中的代码一样并同时执行,其结果构成最终的aspx代码。
Eval("person") 单向数据绑定
Bind("person") 双向数据绑定
(6)
怎样设置资源文件的dll的属性的Language:
The information on the exe property page is the Win32 resource information, not the .Net resource information. If you use ILDasm to view any satellite assembly in the language directory, we will see the language attribute in the assembly manifest.
For other Win32 resources, such as company info, copyright etc..., it seems that VS.net IDE will only generate in the main assembly not for the satellite assembly. However, we can use Al.exe with corresponding options to embed the information in the satellite assembly. I think this must be the limitation of VS.net IDE.
以上资源dll的Language不能修改的原因。
解决:
1.convert .resx到.resources
2.use AL.exe to convert the mytext.de.resources to myapp.resources.dll
3.修改Language的方法是用/win32res:filename参数追加一个本地化的.res文件
获得.res文件的方法:
创建一个Win32 DLL工程:
1、 打开Visual Studio 2003,选择文件-新建-工程,输入工程名如MyAppDEU创建一个德文版本,单击确定;在程序设置页,选择DLL及空项目。
2、 把它转换为一个资源DLL:打开项目属性,在“配置”下拉框中选择“所有配置”;打开链接器-高级,将“纯资源DLL”设为“是”。另外,如果你使用Visual C++ 6.0,则需要手工在链接设置的编辑框中添加 /NOENTRY作为命令行选项;而Visual C++ 2005,与Visual C++ 2003类似,在链接器-高级里,选择“无入口点”为“是”。
或者选Configuration Properties-General-Configuration Type: Static Library (.lib).也能编译通过。
3、 创建一份EXE资源文件的副本,并把它添加到DLL工程中:建议将MyApp.rc文件改名成所需的语言版本,如MyAppDEU.rc。
4、 修改路径:在资源视图中,鼠标右键单击MyAppDEU.rc,打开“资源包含”,修改所有包含资源文件的路径。每种语言都有会一个子目录l.xxx,例如,修改#include "afxres.rc"为#include "l.deu\afxres.rc"。
5、 设置语言属性:在资源视图中,打开“版本信息version info”(如果没有就创建一个),设置语言属性为正确的语言,如German(Germany),确保语言匹配DLL名中的三个字母。
Resource File Generator (Resgen.exe)
http://msdn.microsoft.com/en-us/library/ccec7sz1(VS.80).aspx
Assembly Linker (Al.exe)
http://msdn.microsoft.com/en-us/library/c405shex(VS.80).aspx
Creating Satellite Assemblies
http://msdn.microsoft.com/en-us/library/21a15yht(VS.71).aspx
al /out:MyGlobApp.resources.dll /v:1.0.0.0/c:fr-FR /embed:MyResource.fr-FR.resources, Private
Note : Check out the Private keyword in the above command. You can use the "private" option if you want dont want other assemblies to use the embedded resource files by default it is "public".
怎样加custom build command-line
http://msdn.microsoft.com/en-us/library/aa645513(VS.71).aspx
(7)
asp.net如何让虚拟目录里面的webconfig不继承主目录config
http://www.cnblogs.com/jams742003/archive/2009/09/14/1566138.html
For some reason, inheritInChildApplications is not a valid property of the location tag for me.
I've done some research and it appears that the DotNetConfig.xsd file for Visual Studio 2005 is incomplete.
I fixed this issue by editing the Location node to read this (add the line in bold):
<xs:element name="location">
<xs:complexType>
<xs:choice>
<xs:any namespace="##any" processContents="lax" />
</xs:choice>
<xs:attribute name="path" type="xs:string" use="optional" />
<xs:attribute name="allowOverride" type="small_boolean_Type" use="optional" />
<xs:attribute name="inheritInChildApplications" type="xs:boolean" use="optional" />
</xs:complexType>
</xs:element>
I also removed other "Warning" and "Messages" by adding missing nodes in my web.config to this file on my development machine.
Where the file is depends on your version of Visual Studio. VS 2005 it was in:
C:\Program Files\Microsoft Visual Studio 8\Xml\Schemas
(8)
利用ASP.NET 2.0的客户端回调功能制作下拉框无限级联动
http://www.webjx.com/htmldata/2006-05-26/1148598784.html
(9) Process, Thread, STA, MTA, COM object
进程相对于一个小城镇,线程相当于这个城镇里的居民,STA(单线程套间)相当于居民房,是私有的,MTA(多线程套间)相当于旅馆,是公用的,Com对象相当于居民房或旅馆里的物品.接下去就好理解了,一个小城镇(进程)里可以有很多很多的(居民)线程,这个城镇(进程)只有一间旅馆(MTA),但可以有很多很多的居民房(STA).只有居民(线程)进入了房间(居民房或旅馆,STA或MTA)以后才能使用该房间里的物品(COM对象),居民房(STA)里的物品(COM对象)只能供这间房子的主人(创建该STA的线程)使用,其它居民(线程)不能访问.同样,只有入住到旅馆(MTA)里的居民(线程,可以有多个)才可以访问到旅馆(MTA)里的物品(com对象),但因为是公用的,所以要合理的分配(同步)才能不会产生混乱.
(10)C#代码构造HTML并输出到页面的指定位置
DaCangJia
源码:Head1.Controls.Add(new LiteralControl("<script type='text/javascript' src='" + Page.ResolveUrl("~/Script/modal/common.js") + "'></script>"));
类似:Literal1.Text = "<table><tr><td>fsadfsa</td></tr></table><script> alert('fasdf');</script>";
源码:lb.Text = "<script> GetRTime(" + Convert.ToString((int)span.TotalSeconds) + ",'" + lb.ClientID + "');</script>";
类似:Label1.Text = "<table><tr><td>fsadfsa</td></tr></table><script> alert('fasdf');</script>";
OBFM
<% =BuildDetailMenu()%>
SPMJ
<% Response.Write(AspxGetLeftMenu()); %>
(11)单线程的单例模式

代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
/// <summary>
/// 对于ASP.NET,两个请求是两个不同的线程。静态变量的作用域是应用程序域,每个线程共享,站点关闭才能消失。
/// 类的同一个实例,在两个请求(两个线程)中,调用它的同一个静态或非静态方法,则互不影响,互相也不阻挡,第二个不用等待,像是调用两个方法。
/// </summary>
public class Utility1
{
private Utility1()
{
//
// TODO: Add constructor logic here
//
}
private static Utility1 instance = null;
internal static Utility1 Instance
{
get
{
if (instance == null)
{
instance = new Utility1();
}
return Utility1.instance;
}
}
public string GetAppPhysicalPath()
{
string appPath = HttpContext.Current.Request.ApplicationPath;
string appPhysicalPath = HttpContext.Current.Server.MapPath(appPath);
return appPhysicalPath;
}
}
(12)PostBack,Response.Redirect,ViewState
象HTML一样,ASPX的Request的一般形式是通过<a></a>或Response.Redirect("Default2.aspx"),但有一种特殊的Request是通过提交表单<form name="form1" method="post" action="Default2.aspx" id="form1">,访问服务器端的自身页面,PostBack其实就是提交表单到自己。
提交表单的这种Request,当Reqeust到服务器端后,IIS会象一般形式的请求一样先创建页面和控件对象,不同的是,IIS会自动的使用表单的数据并改变控件的初始值(回传后,ASP.NET页面框架将解析ViewState字符串,并为该页面和各个控件填充ViewState属性。然后,控件再使用ViewState数据将自己重新恢复为以前的状态。),并最终将.aspx和.cs生成HTML传给客户端。在ASP.NET之前,在回传后将值赋给form中的控件完全是页面开发人员的责任,他们将不得不从HTTP的form中逐个拾取回传值,然后再将其赋给控件。幸运的是,现在ASP.NET可以自动完成这项任务,从而为开发人员免除了一项令人厌烦的工作,同时也无需再为窗体编写大量的代码。
<form id="form1" runat="server">会转化成<form name="form1" method="post" action="Default.aspx" id="form1">。
能PostBack的控件象Button都要求有<form id="form1" runat="server">标签并发在它里面,这是因为PostBack就是提交表单,所以得有表单。
在服务器端使用viewstate的值,实际是在使用提交的表单里面的<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJODEyNDY2MDg4ZGQVqxeeW0TkuCndx+IQ6/YvFch6Tw==" />。当页面在服务器端生成HTML并传给客户端之前viewstate会变成<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJODEyNDY2MDg4ZGQVqxeeW0TkuCndx+IQ6/YvFch6Tw==" />并放在form标签里面。虽然控件的enableviewstate="True"属性不是决定有无<form id="form1" runat="server">标签页面才不会出错的属性,但只有有form标签,控件的viewstate才能起作用,因为它需要提交的服务器才能被使用。该form还必须是服务器端的form,这样在服务器上执行该页面时,ASP.NET页面框架才能添加隐藏的字段。
即使多个控件都设置了enableviewstate="True"属性,但在HTML页面中只有一个<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJODEyNDY2MDg4ZGQVqxeeW0TkuCndx+IQ6/YvFch6Tw==" />。
页面本身将20字节左右的信息保存在ViewState中,用于在回传时将PostBack数据和ViewState值分发给正确的控件。因此,即使该页面或应用程序禁用了ViewState,仍可以在ViewState中看到少量的剩余字节。
(13) Session,ViewState用法
基本理论:
session值是保存在服务器内存上,那么,可以肯定,大量的使用session将导致服务器负担加重. 而viewstate由于只是将数据存入到页面隐藏控件里,不再占用服务器资源,因此, 我们可以将一些需要服务器"记住"的变量和对象保存到viewstate里面. 而sesson则只应该应用在需要跨页面且与每个访问用户相关的变量和对象存储上. 另外,session在默认情况下20分钟就过期,而viewstate则永远不会过期.
数据类型:
但viewstate并不是能存储所有的.net类型数据,它仅仅支持String、Integer、Boolean、Array、ArrayList、Hashtable 以及自定义的一些类型.
其他考虑:
当然,任何事物都有两面性, 使用viewstate会增加页面html的输出量,占用更都的带宽,这一点是需要我们慎重考虑的. 另外, 由于所有的viewstate都是存储在一个隐藏域里面,用户可以很容易的通过查看源码来看到这个经过base64编码的值.然后再经过转换就可以获取你存储其中的对象和变量值. 其实,对于viewstate的安全性问题,asp.net还给我们提供了更多的选择.一般如果要保护viewstate有两种方式: 一种是防篡改,一种是加密. 一说到防篡改,我们就想起了使用散列代码. 没错, 我们可以在页面顶部加入如下代码:Page EnableViewStateMAC=true。这样asp.net就会自动的在viewstate中追加一个散列码,在页面回传时,服务器根据回传的viewstate生成一个散列码,再与回传的散列码相比较,如果不对,则丢弃该viewstate,同时控件将恢复初试状态. (默认情况下asp.net是通过SHA1算法而不是md5算法来生成散列,不过这个可以在machine.config里面配置machineKey validation="MD5"即可),而viewstate加密就更简单了, 只要在machine.config里设置一下machineKey validation="3DES"即可实现用des加密viewstate了.
应用环境:
一些与安全性无关,数据量较小,需要长时间操作的参数,应该用ViewState存取。
Asp.net中的ViewState用法:
昨天看到一个文章,作者在自己的页面中定义了几个全局变量,类型是static,但是这样的定义会存在问题,当一个用户访问的时候不会有问题,但是当大量用户并发访问系统的时候,页面中的这些static类型的全局变量就会出现问题了,然后作者改用了Session变量保存以前由static类型全局变量纪录的数据,因为Session是状态量,只是和某个访问进程相关,这样就不会出现由于static类型引起的问题了。但是这样的话系统中的Session就太多了,我总认为这样不太好,虽然每个一个Session都有一个ID不会冲突。ASP.NET引入了ViewState,可以记录同一个页面的不同PostBack中的一些数据值。所以我的解决方法是:使用例如ViewState["name"]这样的形式记录以前static的全局变量,这样就可以避免这个问题了,因为我的系统是在局域网使用的,ViewState带来的多余的数据量可以忽略不计了。
ViewState是类Control中的一个域,其他所有控件通过继承Control来获得了ViewState功能.它的类型是system.Web.UI.StateBag,一个名称/值的对象集合.当请求某个页面时,ASP.NET把所有控件的状态序列化成一个字符串,然后做为窗体的隐藏属性送到客户端.当客户端把页面回传时,ASP.NET分析回传的窗体属性,并赋给控件对应的值.当然这些全部是由ASP.NET负责的.
设置ViewState:
ViewState可以在控件,页,程序,全局配置中设置。缺省情况下EnableViewState为true。如果要禁止所有页面ViewState功能,可以在程序配置中把EnableViewState设为false。
Page的EnableViewState属性值为true. 控件的EnableViewState属性值为true.
提醒:
1.当存在页面回传时,不需要维持控件的值就要把ViewState禁止.
2.ViewState的索引是大小写敏感的.
3.ViewState不是跨页面的.
4.为了能包存在ViewState中,对象必须是可流化或者定义了TypeConverter.
5.控件TextBox的TextMode属性设置为Password时,它的状态将不会被保存在ViewState中,这应该是出于安全性的考虑.
6.在页面没有回传或重定向或在回传中转到(transfer)其他页面时不要使用ViewState.
7.在动态建立控件时要小心它的ViewState.
8.当禁止一个程序的ViewState时,这个程序的所有页面的ViewState也被禁止了.
9.只有当页面回传自身时ViewState才是持续的.
14)
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727>C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regsql.exe
现在已建立一个SQL Server环境。
15)
进入IIS管理界面,查看ISS网站(Web Sites)属性并选择ASP.NET标签,即可激活ASP.NET环境属性。选择ASP.NET标签上的编辑配置(Edit Configuration)按钮。验证(Authentication)标签包含一个角色(Roles)区,其中的角色管理(Role Management)被激活(应查看这一点)。默认的SQL Server(LocalSqlServer)连接字符串在通用(General)标签中指定。开发环境使用下面的连接字符串:
以下是引用片段:
data source= database_server_name;Integrated Security=SSPI;Initial Catalog=aspnetdb;User Instance=false
将这些改变保存在ASP.NET环境中。
16)
当使用VS2005的WebSite菜单的Asp.Net Configuration时,随后就会弹出网站管理工具Web页面,在此页面中有四个主题(主页、安全、应用程序、提供程序)。继续点击【安全】主题,就会出现【无法连接到SQL Server数据库】的错误信息,在右下角有一个【选择数据存储区】按钮,意思是建议我们对数据存储区进行选择。点击【选择数据存储区】继续进行设置,新的页面会提示“应用程序当前被配置为使用提供程序:AspNetSqlProvider”,下面有两个链接选项,第一个是“为所有站点管理数据选择同一提供程序”,第二个是“为每项功能选择不同的提供程序(高级)”。
这是因为
网站管理工具Web页面和你创建的站点一样,都是使用“你的工程里的Web.config”和“C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config”合并后的配置。而网站管理工具Web页面【安全】和【提供程序】项使用了machine.config中的连接字符串LocalSqlServer(你的工程页面能正常运行是因为你的页面没使用这个连接字符串)。它默认连接的是SQL Server 2005 Express,你没装,所以报错。
所以将LocalSqlSever的值改为项目的连接字符串值即可:
混合验证
"Server=YourServerName;Database=aspnetdb;User ID=sa;Password=Your Password;Trusted_Connection=False"
集成验证
"data source=localhost;initial catalog=ASPNETTest;integrated security=SSPI;persist security info=False"
或者通过在IIS中右键Default Web Site选属性,选asp.net选下面的编辑全局配置的方法改machine.config。
17)
web site和web application主要区别是web site编译以后,所有的aspx都被编译成随机取名的dll,所有的类都必须放在app_cod目录下,优点是可以直接替换有改动的aspx而不需要编译整个项目。web application是把整个项目编译成一个dll,改动一个文件就需要重新编译整个项目,和一般的winform项目类似。
http://blog.csdn.net/naiyoumianbao/archive/2009/05/24/4212248.aspx
web application有References文件夹
There is no thumb rule.
没有经验法则
You prefer single-page code model to code-behind model? use Web Site project.
http://blogs.vertigo.com/personal/swarren/Blog/archive/2007/06/17/web-site-or-web-application.aspx
WAPs can save you a lot of time over
Project type usually has no impact on the capabilities or performance of the application itself – except for any compilation you postpone to runtime.
The full-site compilation tax for Web Site projects is very noticeable
So, for all but the most trivial projects I use a WAP.
But not everyone feels uncomfortable with the compilation tax. Since some folks will choose to use a Web Site project for a productions web app, I'll add this tip: consider compiling and deploying the entire site as a single DLL to avoid the runtime recompilation vulnerability. ScottGu has a number of must-read compilation and deployment tips for Web Site project users
18)DAL 使用动态连接字符串
When the DataSet is created as part of a Web project, the TableAdapter reads connection string values directly from Web.config using the config APIs.
When the DataSet is created as a separate class libary project, the TableAdapter reads connection string values through an associated settings class (compiled from a .settings file at build time). The settings class will read the value from Web.config. As long as you have the correctly-named connection string name in Web.config it should work, for example:
<connectionStrings>
<add name="MyDataLib.My.MySettings.NorthwindConnectionString"
connectionString="Data Source=.\SQLExpress;Initial Catalog=Northwind;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
Here is a solution for DataObject class using Strong Type Dataset.
tblDataTableAdapter mAdapter = new tblDataTableAdapter();
//set Adapter to use the custom connection string from project config file (ex: web.config, or app.config)
string mConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["AConnectionString"].ConnectionString;
if (!string.IsNullOrEmpty(mConnectionString))
mAdapter.Connection.ConnectionString = mConnectionString;
Also the Settings class is internal and sealed, which means it cannot be accessed from outside of the current project. So my GUI project cannot directly access my DAL project and update the Settings value. To get around that limitation I just created a proxy class. The resulting class is:
using DC.Catalog.DAL.Properties;
namespace DC.Catalog.DAL
{ public static classEquipmentConnectionSettings
{ public static void SetEquipmentToConnectToMdb(string MdbFilename)
{ // This only overrides the in-memory copy of the setting. It is not perminate.
Settings.Default["EquipmentConnectionString"] = string.Format(
Settings.Default.EquipmentConnectionStringTemplate
, MdbFilename);
}
}
}
Notice that to update the setting value I had to use:
Settings.Default["EquipmentConnectionString"]
Since the setting Settings.Default.EquipmentConnectionString is readonly I had to use the other way to access the value. The EquipmentConnectionStringTemplate is simple:
Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0}
Every time I change the Access file I am pointing at I call the SetEquipmentToConnectToMdb() method, magic happens in the Typed DataSet and it all just works.
Thanks Kevin. I was hoping to avoid having to reset the connection string
for every TableAdapter.
Here's a workaround that I am considering:
(1) Modify the generated settings code by adding this partial class like this:
namespace MyRootName.Data.Properties
{internal sealed partial class Settings
{internal void SetConnectionString(string connectionString)
{this["DbConnectionString"] = connectionString;
}
}
}
This gets around the read-only characteristic of the generated setting
property.
(2) Add a public method to allow calling this internal code:
namespace MyRootName.Data
{public static class App
{public static void SetConnectionString(string connectionString)
{
MyRootName.Data.Properties.Settings.Default.SetConnectionString(connectionString);
}
}
}
(3) From the client, pass the connection string to the data layer:
MyRootName.Data.App.SetConnectionString(MyRootName.Client.Properties.Settings.Default.DbConnectionString);
This seems to work ok, but there will still be an unnecessary app.config
file hanging around at runtime, and I'm wondering if I will ever run into
trouble as a result of bypassing the read-only characteristic of the
generated property.
http://channel9.msdn.com/forums/TechOff/209406-Connection-String-for-Typed-Datasets/
19)
Understanding ASP.NET AJAX Debugging Capabilities
http://www.asp.net/learn/ajax/tutorial-06-cs.aspx
20)深入剖析ASP.NET的编译原理
http://www.cnblogs.com/InsistYML/archive/2008/07/24/1250189.html
http://www.cnblogs.com/artech/archive/2007/05/26/760292.html
有Product环境的项目,当站点发布时一般勾选“Use fixed naming and single page assemblies” 其它的不勾选。
如果都不选,部署后我曾遇到过下面的错误:
The file '/SalesPortal.master' does not exist.
The file '/GetOrders.aspx' has not been pre-compiled, and cannot be requested.
21)ASP.NET Process Model
http://www.cnblogs.com/InsistYML/archive/2008/07/24/1250284.html
http://www.cnblogs.com/InsistYML/archive/2008/07/24/1250288.html
http://www.cnblogs.com/InsistYML/archive/2008/07/24/1250297.html
A low-level Look at the ASP.NET Architecture
http://www.west-wind.com/presentations/howaspnetworks/howaspnetworks.asp
Asp.Net 构架
http://www.tracefact.net/Asp-Net-Architecture/Http-Request-Processing-Flow.aspx
http://www.tracefact.net/Asp-Net-Architecture/Introduction-to-Http-Handler.aspx
http://www.cnblogs.com/jimmyzhang/archive/2007/11/25/971878.html
22)
ASP.NET 2.0中的跨页面提交
http://activer.cnblogs.com/archive/2006/03/16/351274.html
asp.net 把表单提交到另外一页
http://blog.sina.com.cn/s/blog_4c05a1de0100086d.html
23)
configSections 的 section 元素(常规设置架构)
http://msdn.microsoft.com/zh-cn/library/ms228245.aspx
web.config 限定访问权限 Asp.net的身份验证有有三种
http://www.cnblogs.com/codingsilence/articles/1208540.html
VB
1)
function是函数,sub是子程序,都可以传递参数,但函数有返回值,子程序没有
sub过程是子过程,是在响应事件时执行的代码块。本身没有类型和返回值。
function是函数过程,有返回值,同时有数据类型,即返回值的类型
2)VB 6.0升级到VS2005时,因下面的错误提示而不能自动转换。
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
When attempting to upgrade a VB6 project to VB2005 on a 32bit machine, the
following error is displayed as the wizard is initializing:
Unexpected exception occurred during upgrade engine operation: Not able to bind
to the source (Exception from HRESULT: 0x8004000A (OLE_E_CANT_BINDTOSOURCE)
Cause:
The Regmon log shows we are looking for VBExpress on a 64bit machine:
vbu.exe:2344 OpenKey HKLM\SOFTWARE\Wow6432Node\Microsoft\VBExpress\8.0 NOT FOUND
vbu.exe:2344 OpenKey HKLM\SOFTWARE\Wow6432Node\Microsoft\VBExpress\8.0\VBUpgrade\Sou
rce Language Drivers NOT FOUND
The following key had been erroneously added to the registry during the
installation:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node
and contained one entry for SQL Server. This key should only be present on a 64bit
machine. If this key exists on a 32bit machine, VBU.exe wrongly searches the node
for the components and fails even though the correct entries exist elsewhere in the registry.
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
*** Resolution *** Apr 7 2006 1:12PM robdil
Export and delete the HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node key.
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
I don't have the Wow6432Node key. And the problem is still there.
After a bit more research / hacking (using the great Regmon log) I've found that my problem was fixed after adding these missing keys;
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\VBUpgrade]
"HelpLink"="ms-help://MS.VSCC.v80/MS.MSDNQTR.80.en/commoner/redir/redirect.htm?keyword="
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\VBUpgrade\Source Language Drivers]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\VBUpgrade\Source Language Drivers\Visual Basic]
@="Visual Basic 6.0"
"FileLocation"="VBSLD"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\VBUpgrade\Target Language Drivers]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\VBUpgrade\Target Language Drivers\VB7]
@="Visual Basic 7"
"FileLocation"="vb7tld"
I noticed that the keys were correctly in the "VBExpress" location so I just exported them at the "VBUpgrade" point and then edited the .reg file by replacing the "VBExpress" with "VisualStudio".
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VBExpress\8.0\VBUpgrade]
"HelpLink"="ms-help://MS.VSCC.v80/MS.MSDNQTR.80.en/commoner/redir/redirect.htm?keyword="
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VBExpress\8.0\VBUpgrade\Source Language Drivers]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VBExpress\8.0\VBUpgrade\Source Language Drivers\Visual Basic]
@="Visual Basic 6.0"
"FileLocation"="VBSLD"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VBExpress\8.0\VBUpgrade\Target Language Drivers]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VBExpress\8.0\VBUpgrade\Target Language Drivers\VB7]
@="Visual Basic 7"
"FileLocation"="vb7tld"
3)
VB和VB.NET的大致区别
http://blog.csdn.net/copico/article/details/733231
COM
regasm "my.dll"
regasm "my.dll" /codebase
regasm "my.dll" /tlb /codebase
regasm "my.dll" /u
regasm "my.dll" /tlb /u
/codebase
在注册表中创建一个 Codebase 项。Codebase 项指定未安装到全局程序集缓存中的程序集的文件路径。如果随后要安装正在注册到全局程序集缓存中的程序集,则不应指定此选项。用 /codebase 选项指定的 assemblyFile 参数必须是具有强名称的程序集。
HKEY_CLASSES_ROOT\Microsoft.atWork.WordInterop.Word\CLSID
HKEY_CLASSES_ROOT\CLSID\{EF62C03B-B0C2-46F0-9DFF-2C011332B575}\InprocServer32\2.1.0.2
HKEY_CLASSES_ROOT\Interface\{4E2376EB-DF53-44F4-B740-153659C03DD6}
HKEY_CLASSES_ROOT\TypeLib\{92900ACB-91FC-4D5A-959F-CF1E1900C2C5}
早绑定是指开发代码时候绑定,因为dll没装载到内存也就不知道dll里面有什么类型可以定义变量,所以需要一个类型库.tbl文件给开发时提供类型定义变量,build合成。
晚绑定是指部署后运行起来绑定,因为此时dll已装载到内存也就知道dll里面的信息,所以开发时只需用类似“Set objInterop = CreateObject("Microsoft.atWork.WordInterop.Word")”定义对象即可。
Win Form开发
(1)某些动作发生前的事件可以用e.Cancel=true;取消此事件例如:Validating事件。如果执行控件A时不想触发另外一个控件B的Validating事件,可以设置控件A的属性CausesValidation为False。
JavaScript
http://www.weiw.com/tech/javadict/ref_a-c.htm Javascript各个函数的使用示例
IE与Firefox在JavaScript上的7个不同句法
http://www.aa25.cn/content.asp?id=788
(1)如果不知道页面中某个控件的下面有什么属性可以用,可以给Javascript代码加断点并调试起来,然后右键此对象选择QuickWatch,之后可以象调试.cs文件里的代码一样使用。
(2)在.cs中加脚本的方法:
当给某个控件加脚本时可以用ddlID.Attributes.Add("onChange", "javascript:ControlItemEnable1();");
当给页面中加脚本时候可以用:
Page.ClientScript.RegisterStartupScript(~) 脚本块出现在Form结束符前,一般用于初始化Form页面,加载时启动。也可以注册Javascript文件。
Page.ClientScript.RegisterClientScriptBlock(~) 脚本块出现在Form开始符之后,一般用于注册与Form初始属性无关的脚本块。
参数key相同的脚本块只有第一个会出现在客户端页面上。在.cs文件中注册前用Page.ClientScript.IsClientScriptBlockRegistered(~)检查一下是否注册过。
if (!Page.ClientScript.IsClientScriptBlockRegistered("myKey"))
{
string sct = @"var viewer = document.getElementById('myID');
alert();";
Page.ClientScript.RegisterStartupScript(this.GetType(), "myKey", sct, true);
}
(3)对象的方法和属性
function RP()
{
//相当于静态属性和静态方法,是类的属性和方法
RP.PropertyA = 1;
RP.MethodA = function() { alert("RP.MethodA "); };
//实例属性
this.PropertyA = 100;
//一般不用this增加实例方法,因为这样每个实例都会创建一份方法,不象C#的类的对象会共享实例方法(只有一份),所以用prototype增加实例方法
//this.MethodA = function() { alert("this.MethodA"); };
}
RP.prototype.PropertyA = 10;
//如果给类的原型增加方法(是实例方法),可以达到C#对象的方法的效果
RP.prototype.MethodA = function() { alert("RP.prototype.MethodA"); };
//下面是使用
alert(RP.PropertyA);
RP.MethodA();
rp = new RP();
alert(rp.PropertyA);
rp.MethodA();
(4)对象(除Global和Math对象以外)有一个默认的属性constructor,保存了对实例的构造函数的引用。this.constructor.prototype表示对象的构造函数的属性prototype
(5)正则表达式
正则表达式的compile的使用

代码
//正则表达式的compile的使用
function FnTest()
{
//创建一个空的正则表达式对象。
var regex = new RegExp("");
//用新的正则表达式替换上面空的,此新表达式将被编译,新的regex对象的效率更快。
regex.compile("[a-z]","g");
//在循环中用新的正则对象。如果重新调用此函数FnTest,regex将被重新创建,compile将失效。
while(1=1)
{
regex.test("abc");
}
}
(6)
Javascript取消事件的执行的方法:window.event.returnValue=false;对在进行中的事件起作用,对完成后的不起作用,如onblur是完成后的事件,就不能取消事件。
(7)当由父页面点击弹出子页面时候,父页面想传值到子页面时候,简单的可以用QueryString,复杂的可以在父页面加隐藏域,子页面通过JavaScript拿到隐藏域的值。
子页面中使用window.opener.document.all.Hidden1.value,此语句适合各种情况如html,aspx。window.opener.Hidden1.value适合父页面必须不是aspx页面,是html页面。
(8)
var current_time = new Data();
current_time.getYear()
current_time.getMonth()
current_time.getDate()
slice(0,1)一直复制到 end 所指定的元素,但是不包括该元素.返回String 对象
substring(12, 17)从 start 到最后(不包含 end )的子字符串的字符串。返回字符串
parseInt("12abc") // 返回 12。
(9)
javascript常用方法
http://www.cnblogs.com/meil/archive/2006/07/27/460525.html
JavaScript就这么回事
http://wenku.baidu.com/view/19800c284b73f242336c5ff8.html
预载入和JavaScript Image()对象-Javascript教程 -华夏名网资讯中心
http://www.sudu.cn/info/article/articleInfo.php?aId=122881
AJAX
(1)
掌握 Ajax 系列:
http://www.ibm.com/developerworks/cn/web/wa-ajaxintro/
(1)"An extender can't be in a different UpdatePanel than the control it extends." error really needs debugging information"错误。
出这里错误的ajax 控件一般为有target属性的,指定到一个updatePanel里面的控件里。
一个简单的解决方法可以把ajax 控件也放进updatepanel里。但不是对所有的有效的
That is a difference of the new release over previous... The error however is explicit - any controls that have target properties to point to something that the Update Panel triggers on can only be placed within the update panel.... HOWEVER... there is an override by programtically overriding it using the "ChldrenAsTriggers" property...http://ajax.asp.net/docs/mref/0b850465-67ca-2600-9fdc-2c16d689ab89.aspx
(2)Asp.net Ajax的PopupControl控件的CommitProperty属性是指:目标控件的客户端属性,这个属性是它的值在弹出窗口选择完值后要更新的属性,比如可以是TextBox客户端属性value(注:不是Text属性),即是<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>生成HTML标签<input type="text" name="textfield" value="aa">后的属性value。
最关键的地方是弹出控件选择值后,值被Ajax PopupControlExtender管理,PopupControl控件然后把值传给客户端TextBox的value属性。
(3)当用户快速点击按钮或其他会导致postback的动作时(即每次request还没有来得及接受到response就又再点击其他按钮)会发生下面的错误:
Invalid postback or callback argument. Event validation is enabled using in configuration or in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.
原因如下:
这是由于在net2.0里增加了一项页面验证:enableEventValidation此属性默认值是TRUE。
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="AEBnx7v.........tS" />
在我们的页面PostBack的时候,asp.net会根据存储在这个隐藏控件中的Value来校验你点击的BUTTON被委托的事件是不是有效的,当它发现postback的资料不是原始的控制项发出来的就会产生上述异常,如果网页上有一些特殊的写法会去修改postback资料也会出现这个错误。
通常产生这个错误都是由于在该隐藏控件还没有被render出来之前执行了postback。
解决办法如下:
1.禁用事件校验,不过这个会产生安全问题, 在页面里用<%@ Page EnableEventValidation="false"%>,也可在web.config里<pages enableEventValidation="false"/>
2.呼叫ClientScriptManager.RegisterForEventValidation
(4)AJAX的<asp:UpdatePanel></asp:UpdatePanel>所囊括的部分区域被PostBack时其内的控件都会被恢复成初始状态,所以此前如果
<asp:TextBox ID="aa" runat="server">在Javascript里被设置成了不可编辑当PostBack时就会变成可编辑,所以应该设成
<asp:TextBox ID="aa" runat="server" Enabled="false">
(5)AJAX发送请求后的监视readystate的函数和原来的宿主页面内的函数是两个不同的线程。onreadystatechange的承接函数和监视readystate的函数在同一个线程,有执行的先后顺序的。
oXMLHttpRequest.open(bstrMethod, bstrUrl, varAsync);
当varAsync为true时为异步请求,宿主页面发送AJAX请求同时也会为AJAX再开一个线程用于处理此请求、监视readystate的状态等操作,此时宿主页面不会等此线程结束(请求返回)而是继续执行宿主页面的代码。
当varAsync为false时为同步请求,宿主页面发送AJAX请求同时也会为AJAX再开一个线程用于处理此请求、监视readystate的状态等操作,此时宿主页面只有等此线程结束(请求返回)才会执行宿主页面以下的代码。
document.writeln(sText);函数会覆盖掉当前页面内的所有代码,最后页面上内容只是其参数的内容,但不会覆盖掉提取到内存的代码。
document.writeln(sText);输出的内容会自动加入换行。document.write(sText);不加换行。
页面标签如“</head>”如果想作为js的字符串则要分开写如var str1 = "</"; var str2 = "head>";不能写成var str = "</head>";因为此时会当成页面标签了。也可以前加转义字符“\”。
(6)
1.如果浏览页面时提示下面的错误:
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Could not load file or assembly 'System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
Source Error:
Line 51: <compilation debug="true">
Line 52: <assemblies>
Line 53: <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
Line 54: <add assembly="System.Web.Extensions.Design, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
Line 55: <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
Source File: E:\M\PerforceRoot\Olympic\OBFM\Web\web.config Line: 53
2.或者拖crystalreportviewer控件到页面提示:memory 写保护时,
3.或者一些系统提供的类找不到,
以上的异常的原因可能是没装ASP.NET 2.0 AJAX Extensions 1.0
也可以通过把System.Web.Extensions.Design.dll和System.Web.Extensions.dll放到web工程的Bin目录里来解决(当部署到产品环境时用此法)
(7)
当页面继承了master page,并使用了AJAX控件,如果出下面的错误:
找不到AjaxControlToolkit_AjaxTk\Release\AjaxControlToolkit\ExtenderBase\ScriptObjectBuilder.cs为debug,之后页面显示下面的错误:The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>)
当使用了AjaxControlToolKit时候会引起这个错误。
You need to move the script block out of the head tag. The problem is due to the runat="server" clause in the head tag and is related to ASP.NET 2.0 not allowing this syntax.
I remove runat="server" from head tag and it work.
When the MaskedEditExtender/CalendarExtender is used, a <LINK ...> tag to a stylesheet will result in this error. One workaround is to move the CSS file to a theme folder and add a reference to the theme in the web.config file <pages theme="themeName">. Each page needs to have the "<head>" tag replaced with "<head runat="server"> and any "<LINK ...>" tags removed.
CSS
(1)下载CSS背景图片的方法
比较各个方法后,可以用“CSS图片批量获取工具”导出HTML,然后打开此页面,然后右键页面,选用快车下载全部链接。可选择自定义匹配模式,来获得正确的路径。
1.网际快车FlashGet3.3,Tool-打开“资源探测器”。在“资源探测器”中打开“File”菜单下选择“选项”命令进入,然后在“高级”选项栏中勾选“探测CSS中的图片”。
2.CSS图片批量获取工具.exe v1.0,基于已有的.css文件,获得所有的背景图片的绝对路径,然后下载,但现在的下载功能不能用。
3.Firefox浏览器,安装Web Developer插件。在火狐中打开网站,选择插件上的“图片”-“查看图片信息”按钮,这时会新打开一个页面,本页中的所有图片都显示出来了。想要哪一个,只需另存为。
(2)IE Developer Toolbar的问题 I dont get DOM tree and I can't use the select element with mouse pointer.
解决办法:
1.因为和FlashGet 3.3冲突了。去到Tools - Internet Options - Programs - Manage add-ons - FlashGetBHO - Enable。我做下面的更改就解决了。
2.Tools - Internet options - Security Tab - Local Intranet - Custom Level - Run ActiveX Control or PlugIn (Administrator Mode)
3.Tools - Internet Options - Programs - Manage add-ons - IE Developer Toolbar BHO - Enable
4.Tools - Internet Options - Advanced - Enable third party browser-extensions (requires restart)
(3)
Microsoft.AlphaImageLoader滤镜:
IE7本地预览图片解决方法(也直接可在IE6中使用)
http://hi.baidu.com/mmforever/blog/item/550dcaef4069a832adafd561.html
Microsoft.AlphaImageLoader滤镜
http://blog.163.com/like_juanlv/blog/static/126750272201032231846216/
Microsoft.AlphaImageLoader滤镜讲解
http://www.cnblogs.com/JustinYoung/articles/1250260.html
上传图片前预览
http://www.cnblogs.com/BZZ/archive/2008/01/25/1053073.html
Crystal Report
(1)用向导给水晶报表CrystalReportViewer加ReportSource时(Propertyies-DataBindings-ReportSource)如选Custom binding expression则其值的格式为:@"C:\Program Files\Microsoft Visual Studio .NET 2003\Crystal Reports\Samples\Reports\General Business\World Sales Report.rpt",即:一要为绝对路径,二要加双引号,三为了表示此“\”不是表示转义字符的作用前面要加@。
(2)Crystal report 出现
“
The maximum report processing jobs limit configured by your system administrator has been reached.
Exception Details: System.Runtime.InteropServices.COMException: The maximum report processing jobs limit configured by your system administrator has been reached.
”
错误的解决办法:
WEB下的水晶报表在正常运行一段时间后会出现以上错误,后来发现,水晶报表会在注册表中注册,并限制了打印数量为75,在“开始-Run”中运行regedit命令后在注册表编辑器里更改以下注册表内容:
HKEY_LOCAL_MACHINE\SOFTWARE\Crystal Decisions\10.2\Report Application Server\InProcServer\PrintJobLimit
或
HKEY_LOCAL_MACHINE\Software\Business Objects\Suite 11.0\Report Application Server\InProcServer\PrintJobLimit
将PrintJobLimit由75改为0,然后重启动计算机后,故障排除。
也可以通过关掉电脑右下脚的“ASP.NET Development Server”再浏览页面的方法解决这个异常。
上面的异常出现在ReportDocument.Load();之后,如果ReportDocument.Load();被写成
try
{
ReportDocument.Load();
}
catch ()
{
}
则提示下面的错误:
“
Invalid report file path.
Exception Details: CrystalDecisions.CrystalReports.Engine.LoadSaveReportException: Invalid report file path.
”
(3)水晶某些数据为汉字时打印出现“方框乱码”的解决办法:乱码一般是字体问题,在报表文件里右键出现乱码的字段-Format Object-Font将Font文本框改成宋体。
(4)在设计Reporting Services报表时如果左面没有数据库字段浏览窗口,可以通过“View-Datasets”掉出来。
(5)“System.Runtime.InteropServices.COMException: Invalid pointer”这个水晶报表的异常的原因可能是在“Database-Database Expert”里对水晶报表建立的连接数据库的连接已经没了。
(6)如果水晶报表预览时显示不出来数据,可以右键Database Fields-Database Expert-Links去掉其中多余的Link。
(7)如果在Database Expert中想通过Project Data设置报表的数据源,但Dataset.xsd文件又不在Web Site工程里即在Project Data中看不到想用的Dataset.xsd,可以先将报表建立在和那个Dataset.xsd在同一个工程下就可以用了并且可以设计报表了,然后在将此报表拷贝到相应工程里。
如果在Database Expert中用Dataset作为设计报表时的数据源时,Dataset视图中的表的字段可以自己构造既增加你想要的字段,也可以自己增加外键关系。
如果在Database Expert中多个表中有些表没有link关联,可以在Database Expert中的links里通过用鼠标拖一个表的字段到另一个表的字段上来给它们关联,也可以在.cs中的Dataset中构造所需的多个主表,然后写下面的代码:
ReportDocument docObj = new ReportDocument();
docObj.SetDataSource(dataset);
(8)如果想在Database Expert给水晶报表增加个表但建立的连接没有了即看不到那些表了,则可以在History里找到你以前的连接重新建立,之后加你想加的数据库表到水晶报表文件。
(9)对CrystalReportViewer控件的属性设置如下:
EnableDatabaseLogonPrompt="False" 页面不提示输入登陆数据库信息的对话框,此时可以在程序中设置登陆信息。
HasToggleGroupTreeButton="False" 不出现“显示/隐藏树”的按钮。
DisplayGroupTree="False" 默认左边的树是不显示的,点按钮才显示。
DisplayGroupTree="False" 不显示左边的树状结构。
HasCrystalLogo="False" 不显示水晶报表logo。
PrintMode="ActiveX" 设置点击打印按钮时出现的提示形式。
(10)当水晶报表重复多次显示一条记录时,有两种解决办法:
A.先在Database Expert中只导入一张表不要一次把所需的报表都导入,之后设计报表,显示正确后,再一次性的导入其他所需的数据库表,如果在程序中用ReportDocument给报表赋数据源则只需要用Dataset取出第一个表的字段(不用追溯其他关联表的字段,Crystal Report会根据主表即第一个导入的表并通过自己的link得到其他关联表的所需字段),但要保证Database Expert中link存在。因为如果一次性的导入所有所需表会让Crystal Report不知道哪个是主表。
B.在Database Expert中一次把所需的报表都导入,并删掉所有的link,在代码中用Dataset在数据库中取出所有导入表中的所需字段,把Dataset给ReportDocument,再用ReportDocument给报表赋数据源。
(11)如果既想用ReportDocument给报表赋数据源,又在Database Expert中一次把所需的报表都导入,可能浏览页面时会报下面的错误:
“Cannot determine the queries necessary to get data for this report. Failed to open a rowset. Error in File C:\DOCUME~1\jqli\LOCALS~1\Temp\NOCMR{30B5E15A-2756-44D8-AEA7-0A4723A9CBA7}.rpt: Failed to open a rowset.”
两种解决办法:
1.是重新设计报表且分两次打开Database Expert第一次只导入一张表作为主表,第二次导入其他所需的表。
2.除了主表外都删掉,再打开Database Expert导入其他表。
(12)如果水晶报表显示不出数据或显示的记录数目比用SQL命令查水晶报表主表得到的记录少,可能原因是因为水晶报表内不只一个表而是有很多关联表但从主表向下追溯时可能传了null造成此条由多表组成的一行记录查不出来则少了此个记录。
(13)如何调节水晶报表.rpt文件的最大宽度:
1.右键报表空白处-Design-Printer Setup,在Paper栏里设置Size
2.点击.rpt文件上某个节,选择Section Expert-Details-勾选Format with Multiple Columns-标签页会多出一个标签为“Layout”-点击“Layout”标签后在里面就可以设置报表的宽度了。
Reporting Service
(1)电脑A放置代码-有report view,电脑B安装有数据库和report server,如果在A上安装过TFS再卸载后并且删掉了A上IIS上的report server应用程序池后,可能造成报表显示不出来,页面提示:
为用户“HSLCN\CSSERVER$”授予的权限不足,无法执行此操作。 (rsAccessDenied)
解决办法:
打开B电脑上的IIS的ReportServer应用程序的Properties-Directory Security-Edit-勾选Enable anonymous access,将默认帐号IUSR_HCSSERVER改为域帐户,如输入B电脑的域帐户,注意域帐户一定要加上域名如“hslcn\hcsserv”,可通过Browse的Check Names来检查输入的帐户的正确性。
(2)
要使站点的Reporting Service报表能访问另一个电脑的数据库则需要将IIS的账户如REDMOND\DMSITSUSWEB01$加到两个地方,一个是加此账户到数据库。另一方面是加此账户到报表管理器的安全性里。
(3)当部署Reporting Service工程到产品环境时,因产品环境可能没有报表运行所需的dll,所以需要拷贝“C:\Program Files\Microsoft Visual Studio 8\ReportViewer”下的三个dll到网站的Bin目录下Microsoft.ReportViewer.Common.dll,Microsoft.ReportViewer.WebForms.dll,Microsoft.ReportViewer.WinForms.dll。
(4)当在VS2005中部署Reporting Service报表时候,如果遇到The underlying connection was closed. Could not establish trust relationship for the SSL/TLS secure channel错误:
SQL2005下取消SSL
在start-->program files-->microsoft sql server2005--> configurtion tools-->reporting server configuration.在 report server virtual directory --> uncheck the require secure socket layer (ssl) connections--> 点击apply。
SQL2008
SQL2008安装报表服务的时候有时候会默认设置SSL可用,可通过下面方法取消SSL。在start-->program files-->microsoft sql server 2008--> configurtion tools-->reporting service configuration Mannager.在Web Service URL 和Report Mannager URL-->删除SSL的URL。
(5)当在VS2005中部署Reporting Service报表时候,如果遇到unable to connect to remote server错误的解决办法:
SQL2005打开“E:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer”
如果是SQL2008则打开“E:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER2008\Reporting Services\ReportServer”找到rsreportserver.config文件将SecureConnectionLevel的值设置成0。
解释:
通过将 RSReportServer.config 文件中的 SecureConnectionLevel 设置为 0 以将报表服务器配置为不尝试检测本地 SSL 证书。
如果选中了“要求安全通道 (SSL)”复选框,则配置元素 SecureConnectionLevel 设置为 3,即最安全、最具限制性的级别。否则,SecureConnectionLevel 元素的值设置为 2。
如果是在安装程序运行后选中“要求安全通道 (SSL)”复选框,则不会将配置文件元素 SecureConnectionLevel 的值从 2 修改为 3。您必须手动更改此值。
(6)
当通过Reportserver站点访问报表时,出现下面的错误:
An error has occurred during report processing. (rsProcessingAborted) Cannot create a connection to data source 'xxx'.(rsErrorOpeningConnection).
或
处理报表时出错。 (rsProcessingAborted)。无法与数据源“DataSource1”建立连接。 (rsErrorOpeningConnection) 。
是因为你的report服务器和数据源数据库在不同的机器上,并且你的report数据源使用的集成认证,而集成认证在传递一次后就失效了。
解决办法:
1.将数据源数据库和报表服务器安装在同一台机器上。
2.Use stored credentials or prompted credentials to query external data sources for report data. The credentials can be either a Windows domain account or a database login.
http://msdn.microsoft.com/en-us/library/ms160330.aspx
(7)在SQL Server 2005上,当report有错误时,使其能详细显示错误的方法:
http://technet.microsoft.com/en-us/library/aa337165(SQL.90).aspx
(8)要使reporting Service能远程访问.
1.在Report Manager-属性-新建角色分配里加相应的帐户使其能访问报表服务http://localhost/reportserver
2.在Report Manager为报表的数据源设置访问数据库的帐户. 选择"安全存储在报表服务器中的凭据"或选择"不需要凭据"但此需要在连接字符串中写上凭据.
建立数据源时各参数的意义:
在“凭据”中,指定报表服务器如何获取访问外部数据源的凭据。凭据可通过存储、提示、集成或配置方式用于无人参与的报表处理。
1.若要使用打开报表的用户的凭据访问数据,请选择
“Windows 身份验证(集成)”。如果您的域启用了 Kerberos 身份验证或者数据源与报表服务器位于同一台计算机上,则此选项最为有效。如果未启用 Kerberos 身份验证,则只能将 Windows 凭据传递到另一台计算机。也就是说,如果外部数据源位于需要另行连接的其他计算机上,则会出现错误而不会获得期望的数据。
2.若要使用户在每次运行报表时都输入其凭据,请选择
“凭据提示”。
3.若要使用一组凭据访问数据,请选择
“已存储凭据”。凭据在存储之前是加密的。您可以选择用于确定如何对已存储的凭据进行身份验证的选项。如果已存储的凭据属于 Windows 用户帐户,请选择“用作 Windows 凭据”。
4.如果要在连接字符串中指定凭据,或者如果要使用在报表服务器上配置的最低特权帐户运行报表,请选择
“无人参与的报表处理帐户”。如果未在报表服务器上配置此帐户,系统将提示用户输入凭据,并且不会运行您为报表定义的任何计划操作。
另一个解释:
1.
安全存储在报表服务器中的凭据:如果希望存储用户在访问报表服务器上的报表时所使用的加密用户名和密码,请选择此选项。此选项通常在您需要在无人参与模式下运行报表(例如由订阅启动的报表)时使用。
2.
用户名:如果选择了“安全存储在报表服务器中的凭据”选项,请指定用户在访问报表时必须指定的用户名。
3.
密码:如果选择了“安全存储在报表服务器中的凭据”选项,请指定用户在访问报表时必须使用的密码。
4.
在与数据源建立连接时用作 Windows 凭据:如果指定的凭据是 Windows 身份验证凭据,则选择此框。如果您使用数据库身份验证(例如 SQL Server 身份验证),则不要选择此框。
5.
与数据源建立连接之后模拟经过身份验证的用户:如果选择了“安全存储在报表服务器中的凭据”选项,则此选项可用于允许委派凭据(如果数据源支持)。有关此选项的详细信息,请参阅您的 SQL Server 文档。
6.
Windows 集成安全性:如果选中,则将使用登录用户的凭据访问数据源。
7.
不需要凭据:如果选中,则在连接数据源时不需要或使用任何凭据。
http://technet.microsoft.com/zh-cn/cc161781.aspx
http://msdn.microsoft.com/zh-cn/express/ms160330.aspx
(9)在reporting service里做报表的时候用sp别用script,否则更新scrip后再保存报表,将需要几个小时才能保存成功.
SQL
SQL Server 2005 联机丛书
http://msdn.microsoft.com/zh-cn/library/ms189826(SQL.90).aspx
SQL教程:
http://www.ibook8.com/book/sql.htm
如何一个数据库服务器的存储过程中远程更新另一个数据库服务器的表的内容:
http://www.80diy.com/home/20060118/17/4524068.html#
(1)两种连接字符串的写法:
“Driver={SQL Server};Server=LIJIANQIANG\SQLSERVER2;DataBase=OBFM;user id=HSLCN\jqli;password=ass;”
“workstation id=10.167.9.83;packet size=4096;integrated security=SSPI;data source=LIJIANQIANG\SQLSERVER2;persist security info=False;initial catalog=OBFM”
(2)在存储过程中加上exec pGetDepartmentByPara 'aaa', 'bbb'可测试存储过程pGetDepartmentByPara(@searchCategory nvarchar(20), @searchKey nvarchar(300)),其中后面两个是参数。
用光标亮选哪个语句,点执行后就执行被选择的语句。
(3)将一个表新增加的若干列用语句一次性插入进去:
insert into City(ID, State, Name) select ID, State, Name from Collector.dbo.City where ID not in (select ID from City)
(4)select distinct age from [Person],加distinct可以避免选出重复的值。
(6)
如何查看SQL Server的版本号:
方法一:
打开企业管理器-右键数据库引擎-选属性-在General标签里可以看到版本。
方法二:
select serverproperty('ProductLevel')查看SQL补丁
select serverproperty('ProductVersion')查看SQL版本号
select serverproperty('Edition')查看SQL是企业版还是开发版
Select @@Version查看版本号等信息
(7)char、varchar、nchar、nvarchar、text、ntext区别:
char 定长
varchar 变长,ASCII字符,只占1个字节
nvarchar 变长,Unicode字符,字符都占2个字节
char和varchar的长度都在1到8000之间,它们的区别在于char是定长字符数据,而varchar是变长字符数据。所谓定长就是长度固定的,当输入的数据长度没有达到指定的长度时将自动以英文空格在其后面填充,使长度达到相应的长度;而变长字符数据则不会以空格填充。varchar变长字符数据类型与存储数据的实际长度是一致的。
例如char(100),无论储存了一个字节还是100个字节,它占用的空间都是100字节,而varchar(100)的字段,则如果储存一个字节就是一个字节大小,储存10个字节就是10个字节大小。
N表示national character varying,字符数据采用Unicode编码,可以解决多语言字符集之间的转换问题。它所有的字符都用两个字节表示,即英文字符也是用两个字节表示。
(7)SQL分页语句
-----------------------------------------
--据说效率最高,适用于SQL 2005
-----------------------------------------
declare @topn int,@skipm int
set @topn=100
set @skipm=3000
select * from
(select ROW_NUMBER ( ) OVER (order by pn desc,sn asc) as fno,* from (select top (@skipm+@topn) * from serial order by pn desc,sn asc) a) a
where fno>@skipm and fno<=@skipm+@topn order by fno
-----------------------------------------
--效率高(利用ID大于多少和SELECT TOP分页)语句形式.前提是必需有一列是自动增长类型,且唯一性.即表中主键必须为标识列"[ID] int IDENTITY (1,1)",如果没有主键,可以用临时表.
-----------------------------------------
SELECT TOP 10 * FROM TestTable WHERE (ID > (SELECT MAX(id) FROM (SELECT DISTINCT TOP 20 id FROM TestTable ORDER BY id) AS T)) ORDER BY ID
SELECT TOP [每页记录数] * FROM TestTable WHERE (ID > (SELECT MAX(id) FROM (SELECT TOP [每页记录数*(当前页码-1)] id FROM 表 ORDER BY id) AS T)) ORDER BY ID
-----------------------------------------
--前提是必需有一列是自动增长类型,且唯一性.即表中主键必须为标识列"[ID] int IDENTITY (1,1)",如果没有主键,可以用临时表.
-----------------------------------------
select top 10 * from [order details] where orderid > all(select top 10 orderid from [order details] order by orderid) order by orderid
-----------------------------------------
--效率次之(利用Not In和SELECT TOP分页)语句形式.前提是必需有一列是自动增长类型,且唯一性.即表中主键必须为标识列"[ID] int IDENTITY (1,1)",如果没有主键,可以用临时表.
-----------------------------------------
SELECT TOP 10 * FROM TestTable WHERE (ID NOT IN (SELECT TOP 20 id FROM TestTable ORDER BY id)) ORDER BY ID
SELECT TOP [每页记录数] * FROM TestTable WHERE (ID NOT IN (SELECT TOP [每页记录数*(当前页码-1)] id FROM 表 ORDER BY id)) ORDER BY ID
-----------------------------------------
--利用SQL未公开的游标存储过程实现分页.方法简单且效率高(也有人说“效率低,但是最为通用.建议优化的时候,加上主键和索引,查询效率会提高”)已知的问题就是要多返回一个空的记录集.解决的方法是在前台调用时,用 set recordset=recordset.nextrecordset的方法跳过第一个记录集.
-----------------------------------------
If Exists (Select * From Dbo.Sysobjects Where Id = Object_Id(N'[Dbo].[P_Splitpage]') And Objectproperty(Id, N'isprocedure') = 1)
Drop Procedure [Dbo].[P_Splitpage]
Go
Create Procedure p_splitpage
@Sql nvarchar(4000), --要执行的sql语句
@CurrentPage int=2, --要显示的页码
@PageSize int=10, --每页的大小
@PageCount int=0 OUTPUT --总页数
As
Set Nocount On
Declare @P1 Int
--初始化分页游标
Exec Sp_Cursoropen @cursor=@P1 Output,@stmt=@Sql,@Scrollopt=1,@Ccopt=1,@Rowcount=@PageCount Output
--计算总页数
Select @PageCount=Ceiling(1.0*@Pagecount/@Pagesize),@Currentpage=(@Currentpage-1)*@Pagesize+1
Select @Currentpage
--显示指定页的数据
Exec Sp_Cursorfetch @P1,16,@Currentpage,@Pagesize
--关闭分页游标
Exec Sp_Cursorclose @P1
set nocount off
Go
--调用示例
declare @temPageCount int
exec p_splitpage @sql='select id,name from sysobjects', @CurrentPage=2, @PageCount=@temPageCount OUTPUT
SELECT @temPageCount
-----------------------------------------
--数据量小的时候可用ROW_NUMBER()实现分页功能.适用于SQL 2005
-----------------------------------------
DECLARE @pagenum AS INT, @pagesize AS INT
SET @pagenum = 2
SET @pagesize = 3
SELECT * FROM (SELECT ROW_NUMBER() OVER(ORDER BY newsid DESC) AS rownum, newsid, topic, ntime, hits FROM news) AS D
WHERE rownum BETWEEN (@pagenum-1)*@pagesize+1 AND @pagenum*@pagesize
ORDER BY newsid DESC
-----------------------------------------
--数据量小的时候还可以通过读取出数据然后再写到另一个表里并增加一个ListID字段的值作为序号,可以通过三种方法实现
-----------------------------------------
--1.用外部程序实现:用数据库应用程序,将记录从学生信息表StudInfo,考试成绩表ExamResult中一条一条读出来,再写回成绩排行表ScoreList中,写回的时候赋ListID字段的值.
--2.通过游标赋ListID字段的值.
declare @StudID int
declare @StudName nvarchar(10)
declare @Score int
declare @ExamID int
declare @ListID int
set @ExamID = 8042
set @ListID = 1
declare pScoreList cursor for
select ExamResult.StudID, StudInfo.StudName, ExamResult.Score from ExamResult inner join StudInfo on ExamResult.StudID = StudInfo.StudID where ExamID = 8042 order by Score desc
open pScoreList
fetch next from pScoreList into @StudID, @StudName, @Score
insert into ScoreList values( @ExamID, @ListID, @StudID, @StudName, @Score )
While @@FETCH_STATUS = 0
Begin
set @ListID = @ListID + 1
fetch next from pScoreList into @StudID, @StudName, @Score
insert into ScoreList values( @ExamID, @ListID, @StudID, @StudName, @Score )
End
close pScoreList
DeAllocate pScoreList
--3.通过临时表实现.可以在临时表中建立一个自增的主键,先将记录按顺序写到临时表中去,这时临时表的主键值就是这次考试的排名.也可以不通过自增主键来实现,通过在select into语句中加入identity( int, 1, 1 )字段来实现.
select ExamResult.ExamID, identity( int, 1, 1 ) as ListID, ExamResult.StudID, StudInfo.StudName, ExamResult.Score
into #ScoreList_8042
from ExamResult inner join StudInfo on ExamResult.StudID = StudInfo.StudID where ExamID = 8042 order by Score desc
insert into ScoreList select * from #ScoreList_8042
drop table #ScoreList_8042
(8)安装SQL2005 Developer Edition时,客户端和服务器端都在“Server components,tools,Book Online,and samples”-~-Components to Install-Advanced里,服务器的安装程序:Database services,客户端的安装程序:Client Components-Management Tools。
如果装Reporting Services2005(被装在SQL2005上,用于存储做好的报表),记住装Client Components-Business Intelligence Development Studio(用于在VS2005上建立Reporting Services2005的工程,它总是被装到C盘上,所以C盘空间要满足要求)。同时也最好装上Analysis Services和Integration Services,但也可以不装。
一台电脑上不能同时装Reporting Services2000和Reporting Services2005。
如果要装Reporting Services2000,请先装SQL Server?2000 Service Pack 3a (English) ,如果你跳过SQL Server?2000 Service Pack 3a (English) 的安装,则在安装Reporting Services2000的最后要求你装Service Pack 3a 而且要重启电脑一下才可以安装了,多了一次重启电脑。
如果要想有Reporting Services2000的中文联机丛书,则必须安装“文档和示例-联机丛书-英语”。
如果要卸载Reporting Services2000则可以用安装盘卸载。
如果安装了两个SQL Server则记住第二个Server要启动后才能用。
SQL2000和SQL2005的卸载都不能通过光盘卸载,必须在“添加/删除”里卸载。
如果只安装SQL2000的客户端则安装路径不能选择,卸载时可以通过光盘卸载。
(9)改Server被别人登陆时候使用的验证方式:右键点server名-“Edit SQL Server Registeration Properties”。
改某个用户的属性如登陆方式:到数据库引擎中的Security文件夹中-Logins-双击右面视窗中的某个用户则出现修改页面。
(10)转移另一个数据库的方法:先备份-右键此数据库-All Tasks-Back Up Database-设置保存的路径Destination后点OK;再新建一个数据库-右键此数据库-All Tasks-Restore Database-General里选From device之后选源表-Options里选Eject taps~~和Force restore over~~,之后Original File Name保持默认,Restore As处设置新生成的数据库数据的目的路径和文件名字,点OK即可生成新的数据库;
再备份SQL2005时,要记住在Destination栏里只有一个路径,否则如果有2个那么被备份的数据会被分摊到两个文件里,则恢复时不能成功。在恢复时要注意要覆盖的目标路径默认为源数据库的安装路径,如果目标数据库的安装路径不一样则要手动改一下,否则会报找不到路径的错误。
(11)SQL2005改集成验证模式为混合验证模式的方法:
打开SQL Server Management Studio-用数据库管理员登陆-右键数据库引擎-Properties-Security-此处可以更改了。
让某个用户可以访问某个数据库的方法:
Security文件夹-右键某用户-Properties-User Mapping-勾选相应数据库,Default Schema处可以选dbo-Database role membership for: Collector处可以选db_owner和public
(11)电脑A访问电脑B的SQL Server的设置:
1.能ping通SQL所在的电脑。
2.防火墙必须打开,并且加端口TCP 1433到例外。
3.打开SQL Server Configuration Manager-展开SQL Server 2005 Network Configuration-点击下属的Protocols for MSSQLSERVER-在其右面Enabled “Named Pipes”
一般用的连接协议是NAMEPIPE,因此一般用机器名称。
如果要用IP的话,那么连接协议应该采用TCP/IP。
(12)问题:
Cannot connect to LJQ2.
Addition information:
Timeout expired. The timeout period elapsed to completion of the operation or the server is not responding.(Microsoft SQL Server)
原因:
安装有SQL2005的电脑上,微软操作系统默认提供的Windows Firewall防火墙拦截了另一个电脑的访问数据库的请求。
解决:
Control Panel-Windows Firewall-Exceptions-Add Program-Browse选“C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Binn\sqlservr.exe” -确定。这样就添加到了防火墙里,就可以被访问了。
如果要建立“Microsoft SQL Server Analysis Services”数据源则要加入“C:\Program Files\Microsoft SQL Server\MSSQL.2\OLAP\bin\msmdsrv.exe”到防火墙,不让防火墙阻挡对此程序的访问。
(13)Microsoft SQL Server 2005 安装过程中提示下面的问题:
无法在 COM+ 目录中安装和配置程序集 C:\Program Files\Microsoft SQL Server\90\DTS\Tasks\Microsoft.SqlServer.MSMQTask.dll。错误: -2146233087
错误消息: Unknown error 0x80131501
错误说明: 要执行此任务,您必须具有管理凭据。请与您的系统管理员联系以获得帮助。
解决办法:
http://blog.csdn.net/zhzuo/archive/2007/05/29/1630045.aspx
方法一:
1.运行regedit命令。授权下面的注册表项,Administrators组,“完全控制”权限:
'HKEY_CLASSES_ROOT\Microsoft.SqlServer.Dts.Tasks.MessageQueueTask.DataFileMessage'
'HKEY_CLASSES_ROOT\Microsoft.SqlServer.Dts.Tasks.MessageQueueTask.MessageQueueTask'
'HKEY_CLASSES_ROOT\Microsoft.SqlServer.Dts.Tasks.MessageQueueTask.EncryptionAlgorithmWrapper'
'HKEY_CLASSES_ROOT\Microsoft.SqlServer.Dts.Tasks.MessageQueueTask.ServCompMQTask'
'HKEY_CLASSES_ROOT\Microsoft.SqlServer.Dts.Tasks.MessageQueueTask.Formatter'
'HKEY_CLASSES_ROOT\Microsoft.SqlServer.Dts.Tasks.MessageQueueTask.StringFormatter'
如果不行的话就给HKEY_CLASSES_ROOT赋予Administrators组,“完全控制”权限。
2.点击Reset则安装成功。
方法二:
点击Ignore继续安装,安装成功后按照下面的步骤解决。
1.确认没有安装:
Administrative Tools-Component Services-计算机-我的电脑-COM+应用程序节点-应该不能发现Microsoft.SqlServer.MSMQTask节点。
2.运行regedit命令。授权下面的注册表项,Administrators组,“完全控制”权限:
'HKEY_CLASSES_ROOT\Microsoft.SqlServer.Dts.Tasks.MessageQueueTask.DataFileMessage'
'HKEY_CLASSES_ROOT\Microsoft.SqlServer.Dts.Tasks.MessageQueueTask.MessageQueueTask'
'HKEY_CLASSES_ROOT\Microsoft.SqlServer.Dts.Tasks.MessageQueueTask.EncryptionAlgorithmWrapper'
'HKEY_CLASSES_ROOT\Microsoft.SqlServer.Dts.Tasks.MessageQueueTask.ServCompMQTask'
'HKEY_CLASSES_ROOT\Microsoft.SqlServer.Dts.Tasks.MessageQueueTask.Formatter'
'HKEY_CLASSES_ROOT\Microsoft.SqlServer.Dts.Tasks.MessageQueueTask.StringFormatter'
3.使用cmd执行过程如下:
C:\Documents and Settings\jasonlee>cd C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727>regsvcs.exe "f:\Program Files\Microsoft SQL Server\90\DTS\Tasks\Microsoft.SqlServer.MSMQTask.dll"
4.确认安装成功:
Administrative Tools-Component Services-计算机-我的电脑-COM+应用程序节点-发现Microsoft.SqlServer.MSMQTask节点,可见该COM+服务已经安装上。
(13)错误:
SQL Server Setup failed to modify security permissions on file E:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\ for user v-jjjj. To proceed, verify that the account and domain running SQL Server Setup exist, that the account running SQL Server Setup has administrator privileges, and that exists on the destination drive.
原因:
可以到“E:\Program Files\Microsoft SQL Server\90\Setup Bootstrap\LOG”打开Summary.txt文件查看安装失败的详细解释。
当你卸载后这个“E:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\”文件夹中有残余的数据库文件时,而这些文件在Security里又没有Administrators组并且没有给此组赋予Full Control权限时,则会发生上面的问题。
解决办法:
到文件夹内给每个文件都添加管理员组。右键文件-选Property-选Security标签-添加Administrators组并赋予Full Control权限(并确认v-jjjj账户在Administrators组里),添加v-jjjj账户是不管用的。
(14)SQL2000的调试:
http://blog.csdn.net/fish_zhang/archive/2007/06/30/1672578.aspx
http://blog.csdn.net/fish_zhang/archive/2007/06/30/1672586.aspx
Use SQL Server 2000 Query Analyzer to debug Sql statements:
By the Query Analyzer for SQL 2000, right-click on the stored procedure name. The right-click menu should have a 'debug' option at the very bottom. If this menu option is grayed-out, you should review the permissions associated with your current user.
On the Debug Procedure Window, you will need to check 'Set to null' for each of those parameters that are treated as OUTPUT only.
If you do not want the debug session to affect your database, make sure to check the 'Auto roll back' check box. This will roll back any changes to the database made while debugging the stored procedure.
The first section has 3 parts to show local variables, global variables and your call stack. The local variables can be changed will in the debugger. The global variables can be added or removed will in the debugger.
The last section is the results pane.
To go to a nested stored procedure, click on the 'Step Into' tool on the debug tool bar or press F11.
调试:
开始-所有程序-MS SQL Server-Query Analyzer-Tools-对象浏览器-存储过程-选择要调试的存储过程-右击-选择调试(debug)-输入参数-设置完你的参数值后,点击执行,就是出现一个浮动工具条,上面有单步执行,断点设置等。
FAQ:
服务器: 消息 514,级别 16,状态 1,过程 sp_sdidebug,行 1
[Microsoft][ODBC SQL Server Driver][SQL Server]无法与 GISWORLD"GISQLAND 上的调试程序联络(错误 = 0x80070005)。已禁用对连接 54 的调试。
如果用“本地系统帐户”登陆电脑,而SQL Server服务也用此账户运行,则不能调试存储过程,其解决方法如下:
控制面板-管理工具—服务—MSSQLServer—右键选“属性”—选“登陆”标签—选一个Windows帐户,填写密码,再重新启动SQL Server 2000就可以调试存储过程了。
跟踪:
开始-所有程序-MS SQL Serve-事件探查器(Profiler)-文件-新建“跟踪”,然后数据库的调用情况就会显示出来。
(14)调试多层数据库应用程序
以下方法可在SQL2000和2005中使用。
http://msdn.microsoft.com/zh-cn/library/zefbf0t6(VS.80).aspx
数据库对象的开发生存周期包括编码、部署到数据库、单元测试、应用程序测试和调试等阶段。在 SQL Server 2005 之前,所有数据库对象都是用 T-SQL 编写的。常见的做法是,除了使用 Visual Studio 完成应用程序测试以外,整个生存周期的其他阶段都使用查询分析器工具(它包括 T-SQL 调试器)来完成。在 SQL Server 2005 中,查询分析器已由 SQL Server 管理控制台替换。由于有了创建 SQL/CLR 数据库对象这种新功能,因此可以在 Visual Studio 内部完成调试,而不用在 SQL Server 管理控制台中进行调试(该管理控制台不包括调试器)。
SQL 调试限制
多层 SQL 调试
连接池是提高性能的技术。当应用程序关闭它的数据连接时,SQL Server 连接并未完全关闭,而是保留在可以重用的池中,以便应用程序随后试图重新打开该连接时使用。但是,当通过连接池重新建立连接时,不重新启用 SQL 调试。
调试时,应当临时禁用连接池。为此,可在用来连接到 SQL Server 的连接字符串中设置“Pooling=false”。完成调试后,从连接字符串中移除该属性,默认情况下将启用池。
修改如下:
<connectionStrings>
<add name="NorthwindConnectionString" connectionString="DataSource=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\NORTHWND.MDF;Integrated Security=True;User Instance=True; Pooling=false" providerName="System.Data.SqlClient"/>
</connectionStrings>
如果通过用 OleDbDataAdapter 建立的连接进行调试,命中断点后等待一段较长的时间将导致连接超时。如果试图在此超时过后继续调试(例如,从“调试”菜单选择“继续”),则调试器将退出而不是继续执行。这是预期的行为。调试器退出是因为 OleDbDataAdapter(与 SqlDataAdapter 不同)在发生超时不引发异常。若要解决这个问题,请在使用 OleDbDataAdapter 时将超时值设置为一个较大的数字。
其他限制
触发器必须被激发后才能进行调试:不能直接调试触发器。而应当在将导致触发器被激发的存储过程中开始调试。
在运行时调试中,一系列子选择(例如,在联合中的选择)可以填充网络缓冲区。这可以导致通常运行良好的代码在调试期间暂停运行。这时若要获得更多数据,请使用 RecordSet.MoveNext 和 RecordSet.NextRecordSet。
如果存储过程名包含引号,则可能会收到调试器错误信息。有关更多信息,请参见当调试的过程的名称包含引号时出现错误。
在调试存储过程的同时不能附加到本机 SQL Server 进程。
如何:为项目启用 SQL 调试
从 C++ 项目中启用 SQL 调试
1.
在“解决方案资源管理器”中,单击鼠标右键并在快捷菜单上单击“属性”。
2.
在“<Project> 属性页”对话框中,打开“配置属性”节点,然后选择“调试”节点。
3.
将“SQL 调试”设置为“是”。
为 Visual Basic 或 C# 项目启用 SQL 调试
1.
在“解决方案资源管理器”中选择项目。
2.
单击鼠标右键,然后单击“属性”。
“属性页”对话框随即出现。
3.
单击“调试”选项卡。
4.
在“启用调试器”部分中,选中“SQL Server 调试”复选框。
如何:启用多层调试
启用多层调试
1.
打开“服务器资源管理器”。
2.
单击一个数据库连接以选择它。
3.
右击想要调试的连接,并从快捷菜单中单击“应用程序调试”。
(14)数据库的多层调试的设置的总结:
一.为 Visual Basic 或 C# 项目启用 SQL 调试
在“解决方案资源管理器”中选择项目。
单击鼠标右键,然后单击“属性”。
“属性页”对话框随即出现。
单击“调试”选项卡。
在“启用调试器”部分中,选中“SQL Server 调试”复选框。
二.启用多层调试
打开“服务器资源管理器”。
单击一个数据库连接以选择它。
右击想要调试的连接,并从快捷菜单中单击“应用程序调试”。
三.调试时,应当临时禁用连接池。为此,可在用来连接到 SQL Server 的连接字符串中设置“Pooling=false”。完成调试后,从连接字符串中移除该属性,默认情况下将启用池。
四.调试多层应用程序时,不能使用“逐语句”从应用程序层(C#、Visual Basic 或 C++)中的代码进入 SQL Server 2005(T-SQL 或 SQL/CLR)上的代码。而应当在存储过程代码中设置断点。而且,也不能从存储过程代码返回到调用该存储过程的层上的代码。如果要在返回应用程序层之后继续进行调试,请在应用程序代码中调用存储过程的点之后设置断点。
五.连接帐户必须是 sysadmin 角色的成员。
调试远程数据库最关键的要点在于,要确保启动Visual Studio的Windows用户与连接远程数据库的用户是同一个用户。 此外,该用户必须隶属于sysadmin角色。
例如,你可以在Windows的域中创建一个名为“TestDebug”的用户。 然后使其可以登录到远程SQL Server数据库,并将该用户添加到sysadmin角色内。另外,你还需要使用“TestDebug”用户来登录你的电脑,或者确保使用runas.exe命令启动的Visual Studio运行在“TestDebug”用户下。
六.几点注意事项
1.当勾选或去掉工程的属性页的和"Application Debugging"时,应该重新启动F5调试,所作的更改才起作用。
2.调试那个工程就在那个工程的属性页中勾选"SQL Server 调试",调试此工程时断点才能进去。比如web site调用了web service,你调试web site,那么只需勾选此工程的,勾选web service工程的是不管用的。
3.如不在连接字符串中加Pooling=false则容易在调用SQL Server数据库时候出现莫名其妙的异常。
4.调试完存储过程后应该立即去掉"Application Debugging"和Pooling=false。
当去掉勾选"Application Debugging",要确保编辑器当前打开的不是存储过程,否则去不掉勾选。
(15)在Visual Studio中创建一个SQL Server项目并在该项目中调试Sql Server2005:
http://www.cnblogs.com/eugenewu0808/articles/1287015.html
1.在vs中选择“Sql Server项目”模版
2.可以在项目的属性页里修改数据库连接
3.把要调试的语句放入Test Scripts下的TestScript.sql文件里,并加上断点
4.按F5就可以调试到断点了
(16)当用你的电脑的VS2005去调试远程电脑上的数据库的存储过程,如果抛出下面的错误:
T-SQL execution ended without debugging. You may not have sufficient permissions to debug. Click Help for more infomation.
解决办法:
1.去到远程电脑上。
2.到控制面板-管理工具—服务—MSSQLServer—右键选“属性”—选“登陆”标签。如果SQL Server服务用的是“本地系统帐户”则改成你运行VS2005的电脑的Windows帐户,填写密码,再关掉再重启此服务就可以调试存储过程了。
(17)使用VSTS开发数据库:
此插件用于给Visual Studio 2005 Team Suite增加Database Professional部分,即是增加了建立数据库工程的模版。
Visual Studio 2005 Team Edition for Database Professionals Add-on for Visual Studio 2005 Team Suite Edition:
http://www.microsoft.com/downloads/details.aspx?FamilyID=7de00386-893d-4142-a778-992b69d482ad&DisplayLang=en
用于 Visual Studio 2005 Team Suite Edition 的 Visual Studio 2005 Team Edition for Database Professionals 加载项:
http://www.microsoft.com/downloads/details.aspx?FamilyID=7DE00386-893D-4142-A778-992B69D482AD&displaylang=zh-cn
创建数据库项目
1.
启动 Visual Studio(如果尚未启动的话)。
2.
在“文件”菜单上,指向“新建”,然后单击“项目”。
将出现“新建项目”对话框。
3.
在“项目类型”列表中,展开“数据库项目”节点,然后单击“Microsoft SQL Server”。
4.
在“模板”列表中,单击“SQL Server 2005”。
5.
在“名称”中键入“MyAdvWorks”,并接受“位置”和“解决方案名称”的默认值。
6.
选中“创建解决方案的目录”复选框(如果默认情况下未选中),然后单击“确定”。
随即会创建一个包含 MyAdvWorks 空数据库项目的解决方案。
从现有 AdventureWorks 数据库中导入数据库架构
1.
在“视图”菜单上单击“架构视图”。
如果“架构视图”尚未显示,此时将显示该视图。
2.
在“架构视图”中单击“MyAdvWorks”。
3.
在“项目”菜单上,单击“导入数据库架构”。
说明: |
|
还可以右击“MyAdvWorks”并单击“导入数据库架构”。 |
将出现“导入数据库向导”。
4.
在“源数据库连接”列表中,单击与现有 AdventureWorks 数据库相对应的连接。如果尚未连接到该数据库,则必须先创建与该数据库的连接。有关更多信息,请参见如何:创建数据库连接。
5.
单击“完成”。
(18)SQL智能提示助手 for Visual Studio and SQL Server:
SQLPrompt 3.9
应该是最好用的,可在任何文件中有提示,语法和表名等都有提示,有设置界面,不支持VS2003支持VS2005。
http://www.red-gate.com/
破解
http://www.cnblogs.com/studyzy/archive/2008/07/24/1250101.html
http://www.cnblogs.com/jintan/archive/2008/06/13/1220365.html
http://www.cnblogs.com/jintan/archive/2008/06/16/1223282.html
http://www.cnblogs.com/liuxzh1026/
http://www.cnblogs.com/madgoat/archive/2007/06/21/792297.html
静态分析 破解Spices.net v5.1 --- 试谈.net程序的破解
http://bbs.pediy.com/showthread.php?p=239330
SQL Prompt 3.8.0.244
http://download.csdn.net/source/598801
在VS2005中的SQLPrompt的设置:
1.当此软件过期后可通过重装继续使用。
2.到SQL Prompt菜单-Enable SQL Prompt可开启或关闭SQLPrompt插件。
3.要想智能提示某个数据库的对象,则先要连接到此数据库后才能正确提示:
a.如果你的VS2005-Server Explorer中已经连接到此数据库,可在工具条中点击“Connect”,使当前文件连接到数据库。
b.也可到SQL Prompt菜单-Connect to Server里设置到相应的server和数据库。
4.如果数据库有变化,可到SQL Prompt菜单-Refresh Cache或Catche Management刷新后即可反映最新内容。
5.到SQL Prompt菜单-Options-Inserted Candidates-Case:将3个下拉框都设置成Leave as is可使输入时SQL语句的关键字是首字母大写而不是都大写。
6.到SQL Prompt菜单-Lay Out SQL可格式化SQL语句。
7.到SQL Prompt菜单-Options-Layout:可设置在使用格式化命令后,被格式化的SQL语句的样式。
SoftTree SQL Assistant 3.5
可在任何文件中有提示,不能提示语法,有设置界面,支持VS2003和VS2005。
如果想在VS中使用,需安装完后在Options-Targets里勾选上MS Visual Studio。
有个问题就是我重装VS2005后再打开文件后VS2005就死了,卸载SoftTree SQL Assistant后就好了。
http://d.download.csdn.net/down/512924/mejy
http://www.softtreetech.com/download/sqlassist_setup.exe
http://downloads.zdnet.com/abstract.aspx?&docid=282836&promo=110000
注册码
715253-4G50IRL-1L44-5055
SqlAssist
只在.sql文件中有智能提示,只提示语法不提示表名什么的,没有设置界面。
http://roundpolygons.com/
SqlAssistVS2003Setup1.2.14
http://www.download.com/SqlAssist/3000-2352_4-10491027.html
SqlAssistVS2003Setup
http://downloads.zdnet.com/abstract.aspx?docid=250047
KNOCKS SQL-Sense
可在任何文件中有提示,不提示语法只提示表名等,有设置界面但可设置的选项很少。
http://knocks-solutions.com/SQLSense.aspx
(19)SQL错误检查工具(如有语法错误时以红色底线标出):
SQL格式化工具 Visual Studio 2005 插件 2.0
不能用红线等标出错误,不能实时纠错,需要右键选择来检查。查错的速度有点慢。
http://www.onlinedown.net/soft/49328.htm
(19)
sql代码的折叠Code Folding,大纲显示 Outline ,格式化功能:
1.SQL Server 2008,在连接到SQL Server 2008数据库的情况下,除了格式化上面的功能都有,还能调试。
2.SQL Refactor 和 SQLPrompt 3.9
不能代码折叠,也没有大纲显示。能高亮每一部分,但是模态对话框,不能滚动编辑区的滚动条,所以不能看代码块。格式化功能不错。
3.Ubitsoft SQL Enlight
框的范围太大,等于没框。能高亮每一部分,但是模态对话框,不能滚动编辑区的滚动条,所以不能看代码块。格式化功能不错。
4.CodeLobster
不能代码折叠,也没有大纲显示,运行的时候有点卡。
5.Toad for SQL Server
不能代码折叠,也没有大纲显示,装的时候很慢,好像重量级软件。
(20)
如果您使用远程 Microsoft SQL Server 2000 服务器,并且您希望使用 NT Authority\Network Service 作为域帐户,则您必须添加 Domain\ComputerName$ 项,并使用 Database Creators 和 Security Administrators 权限对其进行配置。这样,Windows SharePoint Services 就可以连接到远程 SQL Server 计算机来创建配置和内容数据库。
(21)
SQL Server 2000 配置SQL Mail
1.为SQLServer创建一个NT域用户帐号,要求具有本地管理员权限
2.双击控制面板的服务图标,找到MSSQLServer的启动设置,将Use System Account改为Use This Account,将刚才建立的NT帐号和口令输入。重新启动SQLServer。
3.在安装SQLServer的服务器上以与启动SQLServer相同的NT帐号登录,然后安装支持MAPI接口的邮件客户端程序,如MSExchangeClient和Outlook97。
4.打开控制面板的电子邮件选项,建立一个配置文件(Profile)。用这个配置文件启动邮件客户端程序,反复检验直至能正常收发邮件。
5.从Sql Enterpriser Manager中,点中相应的服务器图标,从Server菜单中选SQLMail/Configure,将在第4步中建立的配置文件名输入。对于SQL Server2000,上面三步的帐户必须相同,否则此处不能看见Profile。
6.从Sql Enterpriser Manager中,点中相应的服务器图标,从Server菜单中选SQLMail/Start,如果SqlMail的图标变为绿色,则SQLMail成功启动。
(22)看一个Table被哪个SP或View使用,或它使用了那个SP或View,可以右键此表-选All Tasks-Display Dependencies就可以找到相关的依赖了。
(23)DATEDIFF(month, '2009-11-10', getdate())比较的时候精确到月,2009-11-10和2009-11-15是相等的,2009-11-10和2009-12-10是不等的。
(24)当遇到Cannot resolve the collation conflict 问题时,需要在列后加COLLATE sql_latin1_general_cp1_ci_as来解决。

代码
create table test1
(
A varchar(255) COLLATE Chinese_PRC_CS_AS_WS NULL,
B varchar(255) COLLATE sql_latin1_general_cp1_ci_as NULL,
C varchar(255) COLLATE database_default NULL
)
create table test2
(
A varchar(255) COLLATE Chinese_PRC_CS_AS_WS NULL,
B varchar(255) COLLATE sql_latin1_general_cp1_ci_as NULL,
C varchar(255) COLLATE database_default NULL
)
--插入后 字段 a 为 中文 ,b 为 ??
insert into test1 values('中文','中文','中文')
insert into test2 values('中文','中文','中文')
--错
select * from test1 a join test2 b on b.A = a.B
--错
select * from test1 a join test2 b on b.A = a.C
--错
select * from test1 a join test2 b on b.B = a.C
--正确
select * from test1 a join test2 b on b.C = a.C
--正确
select * from test1 a join test2 b on b.A COLLATE Chinese_PRC_CS_AS_WS = a.B
--drop table dbo.test1
--drop table dbo.test2
(25)
SQL中的coalesce函数
http://blog.csdn.net/Johnson_hejun/archive/2008/10/28/3165265.aspx
(26) http://msdn.microsoft.com/en-us/library/ms175003.aspx

代码
--强制类型转换
SELECT CAST(23400.879 AS DECIMAL(18,0))
--第一个参数是操作数,第二个表示以小数点为基点的第几位,第三个为0表明是舍入,非0表明是截断
SELECT ROUND(23400.879, 1, 1)
SELECT ROUND(23400.879, 1, 0)
--舍
SELECT FLOOR(23400.879)
--入
SELECT CEILING(23400.123)
27)
SQL2008
1.安装过程的选项:
a.除了Client Tools SDK, SQL Server Books Online, SQL Client Connectivity SDK 不选。
b.除了Integration Service都选SYSTEM帐号,都设置成Manual。SQL Server Browser没改动。
c.Mixed Mode。Add Current User 为管理员。
d.Install the native mode default configuration.
2.安装SQL Server 2008 R2 Datacenter在xp sp3版上出现这个错误‘The service could not be started. Reason: Service 'MSSQLServerOLAPService' start request failed.’ 并且装完到Services里启动SQL Server Analysis Service也不能启动。
解决办法是:
删除Application events log
a. Open Event Viewer from Administrative Tools menu, or executing "eventvwr" in Run command
b. Click on Application events. Then using context menu or Action menu, choose "Clear all Events" option.
c. Then restart MSSQLServerOLAPService service from Services Management Console.
参见下面:
http://richbackbi.wordpress.com/2010/12/03/mssqlserverolapservice-start-request-failed/
也有人通过改SQL Server Analysis Service的登录帐号成功的,但我没成功,参见下面:
http://www.kodyaz.com/articles/service-mssqlserverolapservice-start-request-failed.aspx
3.安装完SQL后可以到下面删除安装或者卸载日志:
C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log
4.安装完SQL后,我在Service里把所有的都设置成Manuall,除了vss writer是Auto的。所有的都是local system账号,除了Integration Service是Network Service。
5.SQL Server 2008 R2 各个版本支持的功能
http://msdn.microsoft.com/zh-cn/library/cc645993.aspx
http://technet.microsoft.com/en-us/sqlserver/ff625277.aspx
28) SQL2005
1.SQL Server 2005 setup fails when MSXML Core Services 6.0 Service Pack 2 has already been installed
http://support.microsoft.com/kb/968749
29)
--SQL Server2000辅助工具
--http://www.cnblogs.com/rijing2004/archive/2007/10/08/buildsql.html
30)
select * from syscolumns where id = object_id('Test')
select len('abcdefg')
select left('abcdefg', len('abcdefg') - 2)
exec ( 'select * from Test' )
Insert Test ( Id, Name ) values ( 4, 'John' )
Insert into Test ( Id, Name ) values ( 4, 'John' )
31)
--SQL脚本中获得存储过程的结果集,必须先创建临时表,然后插入临时表
--创建一个临时表#tmp,表结构与目标存储过程procedure_name的返回结果集兼容(兼容即可,不必相同)。
create table #tmp
(
ID int,
Person varchar(100),
dd varchar(100)
)
INSERT INTO #tmp
EXEC StoredProcedure1
drop table #tmp
--对于动态SQL语句
INSERT INTO #tmp
EXEC dbo.sp_executesql @querystring_value
--临时表可以用下面方法创建
select *
INTO #tmp
from dbo.Employee
GO
32)
/***************************************************************************************************************
**根据表中数据生成insert语句的存储过程
****************************************************************************************************************/
-----------方法一用游标实现的:
create proc spGenInsertSQL
@TableName as varchar(100)
as --declare @TableName varchar(100)
--set @TableName = 'orders'
--set @TableName = 'eeducation'
DECLARE xCursor CURSOR
FOR SELECT name,
xusertype
FROM syscolumns
WHERE ( id = OBJECT_ID(@TableName) )
declare @F1 varchar(100)
declare @F2 integer
declare @SQL varchar(8000)
set @sql = 'SELECT ''INSERT INTO ' + @TableName + ' VALUES('''
OPEN xCursor
FETCH xCursor into @F1, @F2
WHILE @@FETCH_STATUS = 0
BEGIN
set @sql = @sql
+ +case when @F2 IN ( 35, 58, 99, 167, 175, 231, 239, 61 )
then ' + case when ' + @F1
+ ' IS NULL then '''' else '''''''' end + '
else '+'
end + 'replace(ISNULL(cast(' + @F1
+ ' as varchar),''NULL''),'''''''','''''''''''')'
+ case when @F2 IN ( 35, 58, 99, 167, 175, 231, 239, 61 )
then ' + case when ' + @F1
+ ' IS NULL then '''' else '''''''' end + '
else '+'
end + char(13) + ''','''
FETCH NEXT FROM xCursor into @F1, @F2
END
CLOSE xCursor
DEALLOCATE xCursor
set @sql = left(@sql, len(@sql) - 5) + ' + '')'' FROM '
+ @TableName
print @sql
exec ( @sql
)
GO
-----------方法二用游标实现的:image,text,ntext,sql_variant 列不出现在语句,以后改进。
CREATE PROCEDURE dbo.UspOutputData @tablename sysname
AS
declare @column varchar(1000)
declare @columndata varchar(1000)
declare @sql varchar(4000)
declare @xtype tinyint
declare @name sysname
declare @objectId int
declare @objectname sysname
declare @ident int
set nocount on
set @objectId = object_id(@tablename)
if @objectId is null -- 判??象是否存在
begin
print 'The object not exists'
return
end
set @objectname = rtrim(object_name(@objectId))
if @objectname is null
or charindex(@objectname, @tablename) = 0 --此判断不严密
begin
print 'object not in current database'
return
end
if OBJECTPROPERTY(@objectId, 'IsTable') < > 1 -- 判??象是否是table
begin
print 'The object is not table'
return
end
select @ident = status & 0x80
from syscolumns
where id = @objectid
and status & 0x80 = 0x80
if @ident is not null
print 'SET IDENTITY_INSERT ' + @TableName + ' ON'
declare syscolumns_cursor cursor
for select c.name,
c.xtype
from syscolumns c
where c.id = @objectid
order by c.colid
open syscolumns_cursor
set @column = ''
set @columndata = ''
fetch next from syscolumns_cursor into @name, @xtype
while @@fetch_status < > -1
begin
if @@fetch_status < > -2
begin
if @xtype not in ( 189, 34, 35, 99, 98 ) --timestamp不需处理,image,text,ntext,sql_variant 暂时不处理
begin
set @column = @column
+ case when len(@column) = 0 then ''
else ','
end + @name
set @columndata = @columndata
+ case when len(@columndata) = 0 then ''
else ','','','
end
+ case when @xtype in ( 167, 175 )
then '''''''''+' + @name + '+''''''''' --varchar,char
when @xtype in ( 231, 239 )
then '''N''''''+' + @name + '+''''''''' --nvarchar,nchar
when @xtype = 61
then '''''''''+convert(char(23),'
+ @name + ',121)+''''''''' --datetime
when @xtype = 58
then '''''''''+convert(char(16),'
+ @name + ',120)+''''''''' --smalldatetime
when @xtype = 36
then '''''''''+convert(char(36),'
+ @name + ')+''''''''' --uniqueidentifier
else @name
end
end
end
fetch next from syscolumns_cursor into @name, @xtype
end
close syscolumns_cursor
deallocate syscolumns_cursor
set @sql = 'set nocount on select ''insert ' + @tablename + '('
+ @column + ') values(''as ''--'',' + @columndata + ','')'' from '
+ @tablename
print '--' + @sql
exec ( @sql
)
if @ident is not null
print 'SET IDENTITY_INSERT ' + @TableName + ' OFF'
GO
-----------方法三用select实现的:
create Proc proc_insert
(
@tablename varchar(256),
@wherestr nvarchar(1000)
)
as -- 表名称
begin
set nocount on
Declare @sqlstr varchar(4000),
@sqlstr1 varchar(4000),
@sqlstr2 varchar(4000)
Select @sqlstr = 'select ''Insert into ' + @tablename
Select @sqlstr1 = ' Values ( ''+',
@sqlstr2 = '('
Select @sqlstr1 = @sqlstr1 + col + '+'', ''+',
@sqlstr2 = @sqlstr2 + name + ', '
from ( Select case
-- when a.xtype =173 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar('+convert(varchar(4),a.length*2+2)+'),'+a.name +')'+' end'
when a.xtype = 104
then 'case when ' + a.name
+ ' is null then ''NULL'' else '
+ 'convert(varchar(1),' + a.name + ')'
+ ' end'
when a.xtype = 175
then 'case when ' + a.name
+ ' is null then ''NULL'' else '
+ '''''''''+' + 'replace(' + a.name
+ ','''''''','''''''''''')'
+ '+''''''''' + ' end'
when a.xtype = 61
then 'case when ' + a.name
+ ' is null then ''NULL'' else '
+ '''''''''+' + 'convert(varchar(23),'
+ a.name + ',121)' + '+'''''''''
+ ' end'
when a.xtype = 106
then 'case when ' + a.name
+ ' is null then ''NULL'' else '
+ 'convert(varchar('
+ convert(varchar(4), a.xprec + 2)
+ '),' + a.name + ')' + ' end'
when a.xtype = 62
then 'case when ' + a.name
+ ' is null then ''NULL'' else '
+ 'convert(varchar(23),' + a.name
+ ',2)' + ' end'
when a.xtype = 56
then 'case when ' + a.name
+ ' is null then ''NULL'' else '
+ 'convert(varchar(11),' + a.name + ')'
+ ' end'
when a.xtype = 60
then 'case when ' + a.name
+ ' is null then ''NULL'' else '
+ 'convert(varchar(22),' + a.name + ')'
+ ' end'
when a.xtype = 239
then 'case when ' + a.name
+ ' is null then ''NULL'' else '
+ '''''''''+' + 'replace(' + a.name
+ ','''''''','''''''''''')'
+ '+''''''''' + ' end'
when a.xtype = 108
then 'case when ' + a.name
+ ' is null then ''NULL'' else '
+ 'convert(varchar('
+ convert(varchar(4), a.xprec + 2)
+ '),' + a.name + ')' + ' end'
when a.xtype = 231
then 'case when ' + a.name
+ ' is null then ''NULL'' else '
+ '''''''''+' + 'replace(' + a.name
+ ','''''''','''''''''''')'
+ '+''''''''' + ' end'
when a.xtype = 59
then 'case when ' + a.name
+ ' is null then ''NULL'' else '
+ 'convert(varchar(23),' + a.name
+ ',2)' + ' end'
when a.xtype = 58
then 'case when ' + a.name
+ ' is null then ''NULL'' else '
+ '''''''''+' + 'convert(varchar(23),'
+ a.name + ',121)' + '+'''''''''
+ ' end'
when a.xtype = 52
then 'case when ' + a.name
+ ' is null then ''NULL'' else '
+ 'convert(varchar(12),' + a.name + ')'
+ ' end'
when a.xtype = 122
then 'case when ' + a.name
+ ' is null then ''NULL'' else '
+ 'convert(varchar(22),' + a.name + ')'
+ ' end'
when a.xtype = 48
then 'case when ' + a.name
+ ' is null then ''NULL'' else '
+ 'convert(varchar(6),' + a.name + ')'
+ ' end'
-- when a.xtype =165 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar('+convert(varchar(4),a.length*2+2)+'),'+a.name +')'+' end'
when a.xtype = 167
then 'case when ' + a.name
+ ' is null then ''NULL'' else '
+ '''''''''+' + 'replace(' + a.name
+ ','''''''','''''''''''')'
+ '+''''''''' + ' end'
else '''NULL'''
end as col,
a.colid,
a.name
from syscolumns a
where a.id = object_id(@tablename)
and a.xtype <> 189
and a.xtype <> 34
and a.xtype <> 35
and a.xtype <> 36
and COLUMNPROPERTY(a.id, a.name, 'IsIdentity') <> 1
) t
order by colid
select @sqlstr = @sqlstr + left(@sqlstr2, len(@sqlstr2) - 1) + ') '
+ left(@sqlstr1, len(@sqlstr1) - 4) + ')'' from ' + @tablename
+ ' ' + @wherestr
exec ( @sqlstr
)
set nocount off
end
GO
33)
select ModifiedTime, SourceId, WarehouseId from tblLabor_xref with(INDEX=tblLabor_xref_ind)
where SourceId = 1
create nonclustered index tblLabor_xref_ind on tblLabor_xref(ModifiedTime)
create clustered index tblLabor_xref_ind1 on tblLabor_xref(ModifiedTime)
sp_helpindex tblLabor_xref
drop index tblLabor_xref.tblLabor_xref_ind1
UPDATE STATISTICS tblLabor_xref
34)用Linked Servers代理SQLUAT2,必须到sql的远程宿主机器上去使用Linked Servers,或者在远程宿主机器上运行一次LinkedServers,否则不能在自己的本地机器上使用。
35)
通过SQL Server 2008数据库复制实现数据库同步备份
http://www.cnblogs.com/dudu/archive/2010/08/26/1808540.html
SQL Mobile 2005 Replication配置全过程完全图解
http://www.cnblogs.com/BobGao/archive/2008/06/13/1220384.html
Sql Server Replication 简介
http://yegang5211.blog.163.com/blog/static/81004097200871293919951/
SQL Server 2005 镜像构建手册
http://www.cnblogs.com/killkill/archive/2008/05/23/1205792.html
关于MS SQL Server数据库文件
http://blog.csdn.net/YanJiangbo/article/details/1781117
SQL 连接 JOIN 例解。(左连接,右连接,全连接,内连接,交叉连接,自连接)
http://www.iteye.com/topic/465807
sql多表连接查询inner join, left join , right join ,full
http://jhxk.iteye.com/blog/412406
C#和SQL获得当前月的第一天和最后一天
http://hi.baidu.com/84ww/blog/item/a9c394ecb4ff622063d09f74.html
Enterprise Library
(1)Enterprise Library 下载:
http://msdn.microsoft.com/en-us/library/cc467894.aspx
Microsoft Enterprise Library June 2005
http://www.microsoft.com/downloads/details.aspx?FamilyId=A7D2A109-660E-444E-945A-6B32AF1581B3&displaylang=en
(2)
企业库配置文件连接数据库的两种方法:
1.混合验证:
<connectionString name="CentralDatabase">
<parameters>
<parameter name="server" value="Jasonpremdevsql01" isSensitive="false" />
<parameter name="database" value="CMS" isSensitive="false" />
<parameter name="Integrated Security" value="False" isSensitive="false" />
<parameter name="User ID" value="jason" isSensitive="false" />
<!--<parameter name="User" value="jason" isSensitive="false" />-->
<parameter name="Password" value="123456789" isSensitive="true" />
</parameters>
</connectionString>
2.集成验证:
<connectionString name="CentralDatabase">
<parameters>
<parameter name="server" value="JasonB11MCTSQL05" isSensitive="false" />
<parameter name="database" value="CMS" isSensitive="false" />
<parameter name="Integrated Security" value="True" isSensitive="false" />
</parameters>
</connectionString>
(3)当程序使用企业库时,在操作数据库时,如果抛出下面的异常:
System.TypeInitializationException: The type initializer for 'Microsoft.Practices.EnterpriseLibrary.Data.Instrumentation.DataCommandFailedEvent' threw an exception. ---> System.Security.SecurityException: Requested registry access is not allowed.
at System.ThrowHelper.ThrowSecurityException(ExceptionResource resource)
at Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable)
at System.Diagnostics.EventLog.CreateEventSource(EventSourceCreationData sourceData)
原因是访问程序所在机器的注册表时没有权限。
三种解决办法:
1.到注册表的 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog 加Network Service账户并给其一定的权限。
http://support.microsoft.com/kb/842795/zh-cn
2.
a.安装Microsoft Enterprise Library June 2005
b.需要执行\Microsoft Enterprise Library June 2005\src目录下的InstallServices.bat就好了,是注册一个企业库服务。
这种方法要求你安装VS2003,否则获得“Error: Unable to locate Visual Studio.NET”错误。
You also can use the below solution to register those .dll in ~\Webservice\bin:
1. Copy the InstallUtil.exe from your machine to UAT machine. It should be at C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322. the attached is a InstallUtil.exe. Then unzip it to desktop.
2. Use the "~\Desktop\InstallUtil.exe" "~\Webservice\bin\Microsoft.Practices.EnterpriseLibrary.~.dll" command in cmd.exe to register all of Enterprise Library dll.
3.推荐此方法:打开EnterpriseLibrary源码,重新编译Microsoft.Practices.EnterpriseLibrary.Common项目,编译时把项目属性的build中的Conditional Compilation Constants设置中除DEBUG;TRACE外的其他项都去掉。然后使用新生成的Microsoft.Practices.EnterpriseLibrary.Common.dll
http://blog.joycode.com/ghj/archive/2005/07/26/60364.aspx
http://dotnetjunkies.com/WebLog/sskokku/archive/2005/03/25/61376.aspx
Dreamweaver
1)Dreamweaver MX显示汉字为乱码的解决方法:
以前经常遇到此问题,推荐几种解决方法:
a.在“编辑”-“首选参数”中设置“新建文档”->默认编码:utf-8或者gb2312(取决于你的网页编码),并勾选“当打开未指定编码的现有文件时使用”;此时每次打开文件时都没有乱码了,也不额外加代码。
b.当文件已经打开,并显示乱码时,选择"修改"菜单->页面属性->标题/编码,选择正确的编码方式:通常为utf8或gb2312(取决于你的网页编码),然后点击"重新载入";此时给文件加了<meta http-equiv="Content-Type" content="text/html; charset=gb2312">语句。
c.升级至Dreamweaver 8。
2)当框架的边框看不到时,在工具栏里点击“视图选项”-“可视化助理”-“框架边框”选上就可看见边框了。
Perforce
P4快捷键:
F6-Pending Change-lists
F7-Submitted Change-lists
F10-Client-specs
F11-Users
P4使用注意事项:
1)在VS2003中当“添,删,改(改文件名字)”文件时,工程文件会发生改变,且此文件用的人多,所以此文件用时才打开,用完立即上传。
2)上传代码前务必将本地代码同步成最新的并调试通过后再上传。
3)当文件因和服务器文件版本不一样时而不能提交时,可在P4上右键此文件-Resolve-Schedule File for Resolve来使版本更新。
虚拟机
1)当启动虚拟机时要用鼠标点击工作窗将虚拟机窗口激活才能使按F2键进入BOIS设置相应的东西。
2)如果重装虚拟机的系统则可以从光盘启动,在BIOS里在Boot里用Shift和+将ROM上移到最上面。
3)如果系统已经启动后要改变CD-ROM的ISO源可以不关闭系统,直接在左面Favorites里右键那个虚拟机选Settings之后设置CD-ROM。
4)在虚拟机上也可以用“Open Existing VM or Team”打开一个以前建立的虚拟机备份。
5)如果操作系统已经启动则在Favorites里右键操作系统选Settings-Ethernet的Network connection选Bridged: Connected directly to the physical network时,此虚拟机相当于一台独立的电脑,在其内部配置其自己的Network Connections属性的IP则可以被域中其他电脑访问。
安装操作系统:
a.由紫色的光盘安装WinXP英文版, 这个是gong si ke 录的,不带sp1,2,3. 在其他光盘的SN文件里找到试用过的序列号和激活码.
自己下载sp3安装.可能由于权限关系SP3安装不上, 需要修改注册表.
b.也可安装Redmond的XP.无需注册激活.
用虚拟机装XP:
1.打开Virtual PC Console. 点击New.
2.选择Create a virtual machine.
3.输入路径和名字,例如E:\VPC\XP IE7.vmc
4.Operrating System选Windows XP
5.选择Adjusting the RAM. 并设置到300M
6.选A new virtual hard disk. 点击Browse选择location, 如E:\VPC. name用默认. size设置为6144MB即6G.
7.点击Finish
8.点击Seetings.Networking选择Shared Networking (NAT).
9.安装操作系统.放xp安装盘到光驱.点击Start.在菜单中选CD-选Use Phyzical Driver I:. 然后Close并选Turn Off关掉虚拟机再Start. 此时
将启动光驱并安装XP.
10.安装系统时.不分区直接按Enter.按Enter格式化.
11.当到Regional and Language Options时,选择Customize,选择Languages,勾选Install files for East Asian languages.选Advanced,选
Chinese (PRC).
12.输入Name,Organization
13.输入Product Key.
14.Computer Name.Administrator password.
15.时区选北京
16.Networking Settings-选Custom settings-去掉File and Printer Sharing for Microsoft Networks. 工作组名字参见yins.
17.安装完成拿出光盘.配置计算机.选择Automatic Update.选No, this computer will connect directly to the Internet.选择不注册.Who
will use this computer?为参见yins.点击Finish.
18.选择CD菜单释放光驱.
19.为了解决鼠标不能出来,可按住右面Alt键,可以使鼠标出来.也可由Action安装'Install or Update Virtual Machine Addtion', 可以使用
鼠标集成, 共享文件夹, 更多的Screen Resolution.
20.到Control Panel切换到Classic View. 防火墙打开.Windows Updates设置为了Notify me.
21.右键最低下的托盘处,去掉Lock the taskbar,去掉Group similar,勾选Show Quick Launch.
22.右键桌面选Properties-选Desktop,背景选Ascent-选Settings,选1600by936pixels.
23.由Windows Updates安装系统更新,到安装IE8的时候它会提示你是否安装.SP3能通过Windows Updates自动安装成功.
24.安装360.安装Internet Explorer Developer Toolbar.
Hyper-V
http://book.51cto.com/art/200912/173358.htm
http://www.xker.com/page/e2009/0916/78485.html
Windows Internet Explorer 7 for Windows XP
http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=9ae91ebe-3385-447c-8a30-081805b2f90b
http://www.microsoft.com/windows/downloads/details.aspx?FamilyID=9ae91ebe-3385-447c-8a30-081805b2f90b
Windows Server 2003 安装:
如果安装完毕后汉字都为乱码“方框”,请Start-Control Panel-Regional and Language Options的Languages里勾选Install files for East Asian languages并安装。
如果一些软件安装时的默认路径的中文为“问号”且自解压不能成功时,请Start-Control Panel-Regional and Language Options的Advanced里改成Chinese(PRC)。
配置域控制器时: 在请Start-Control Panel-右键Network Connections选Open右键连接选Properies打开TCP/IP的属性,注意此处的IP,子网掩码为255的对应的IP要相同的不同的计算机才能互相访问。
用域用户登陆后要想能在机器上安装软件要将此域用户加入到本地管理员组里,右键My Computer-Manage-Local Users and Groups-Groups里右键Administrators选属性加入域用户cs\ljq2
当域用户登陆过一次本机后,下次登陆时即使域控制器没有启动或网络没有连上,也能登陆到本机上,这样可以实现“本机做为域中的某个用户安装TFS,本机上的虚拟机做为域控制器,只有第一次本机登陆时要借助第二台实体电脑(上面有相同的域控制器服务)”
域控制器和域用户的时间都保持一样才能互相访问。
在Start-Run里用到的一些命令: AZMan:run-azman.msc或run-mmc
域的配置: 公司网络结构:
10.167.xxx.xxx网关(物理上就是交换机)
/ \ \
10.167.26.xxx网关 10.167.26.xxx网关 公司域控 / \ \ / \ \
My域控A PC1 PC2 PC3 PC4 My域控B在Local Area Connection Properties-Internet Protocal (TCP/IP) Properties中:
域控制器的IP地址最好是固定的,也可以是动态的但有时候可能会联不上域控。
域控的“IP address”和“Prefereed DNS server”的值要相同。
“Default gateway”的值是域控电脑所处网段的交换机的IP,“Default gateway”用来访问外网,如果指定的不是你所处网关的IP而是其他网关的IP,则不能访问外网。小的局域网用HUB就可以连上,HUB也可以连HUB。
“Use the following IP address”处是网关所管辖下的用于标识电脑自己的IP地址。
“Use the following DNS server addresses”处的地址是域控的IP。两个IP可以在不同的网关(网段)里。
将电脑加入域的方法:右键My Computer-Properties-Computer Name-Change:如果以前加入过别的域则先改成加入workgroup在加入域,Computer Name 可随便起。
一个公司的域用户可以这样建立:
公司名称OU
/ \
组OU 用户OU
| / \
存储所有组 部门OU1 部门OU2 / \ / \
用户1 用户2 用户3 用户4 Symantec自动更新病毒库的方法:打开Symentec AntiVirus-files-Shedule Updates-设置任务。
(2)怎样成功设置IE的安全级别:
Tools-Security-Custom Level-此时选好等级后,一定要点击“Reset”才能设置成功。
(3)
如何进行端口映射,以便外网(internet)访问内网(局域网):
http://blog.sina.com.cn/s/blog_467738e3010006x1.html VSTS 1)一台电脑既做域控制器又做TFS的方法:
在一台临时的电脑B上安装虚拟机并在此虚拟机上安装域控制器,在A电脑上安装TFS(以B的虚拟机做为域控制器),一切成功后,将B的虚拟机上的操作系统文件拷贝到A上,关掉B上的虚拟机,打开A上的虚拟机域控制器(此时为虚拟机Creater一个新的UUID),此时一台电脑上可运行二者了。
2)服务器端的TFS安装:
安装SQL Server 2005企业版后最后用TFS自带的补丁而不要用sp1,因为好像sp1可能会导致Integration Services不能启动,sp1也可能会影响Reporting Services不能使用。
安装TFS时如果出现下面的错误:
“Error 32000. The command line '"C:\prgram Files\Common Files\Microsoft Shared\Web Server Extensions\60\bin\Stsadm.exe" ...' returned non-zero value -1.”
则可能是SQL Server和Sharepoint的安装顺序不对,WSS要装在SQL Server之后,解决的办法是卸掉WSS重装,参见:
http://blogs.msdn.com/willbu/archive/2006/08/23/Common-Team-Foundation-Server-installation-errors-and-possible-resolutions.aspx http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1631657&SiteID=1 应用程序层会使用IIS的Default Web Site站点,将整个站点都占用,其下的任何站点都会有问题。而且会修改其下的网站的应用程序池到TFS。
双服务器部署会在数基层生成报表的数据库。会使用8080端口。
单双部署都会使用数据库和报表的默认实例。
安装有TFS应用层的机器即wws2.0的不能装MOSS2007即WWS3.0
单服务器部署
一安装 Internet 信息服务 (IIS)
1.请选择“ASP.NET”。
2.请不要选择“FrontPage 2002 服务器扩展”。
二安装 Microsoft SQL Server 2005
1.使用 Team Foundation Server 安装帐户(例如 Domain\TFSSETUP)登录到 Windows。
2.在“要安装的组件”页上,选择下面的组件,然后单击“高级”。
SQL Server Database Services
Analysis Services
Integration Services
Reporting Services
工作站组件、联机丛书和开发工具
不需要 Notification Services。
3.在“实例名”页上,选择“默认实例”,然后单击“下一步”。
4.在“服务帐户”页上,选择“使用内置系统帐户”并从列表中选择“本地系统”。在“安装结束时启动服务”中,选择所有服务:“SQL Server”、“SQL Server Agent”、“Analysis Services”、“Reporting Services”和“SQL Browser”,然后单击“下一步”。
5.在“报表服务器安装选项”页上,选择“安装默认配置”,然后单击“下一步”。
三安装 Microsoft SQL Server 2005 修补程序
1.在数据层计算机上,打开“SQL Server 配置管理器”,右击“SQL Server 浏览器服务”,然后单击“停止”。
2.在 Team Foundation Server 安装媒体上,找到 SQLServerKB 文件夹。
找到与您的操作系统和语言对应的可执行文件 (.exe),如 AS2005-KBnnnnnn-x86-ENU.exe,然后双击该文件以启动 Hotfix Installer(修补程序安装程序)。
3.在“SQL Server 配置管理器”中,右击“SQL Server Browser 服务”,然后单击“属性”。
在“服务”选项卡上找到“启动模式”,然后选择“自动”。
在“登录”选项卡上,单击“启动”。
注意
如果在“登录”选项卡上未启用“启动”,则单击“服务”选项卡,将“启动模式”设置为“禁用”,然后再次选择“自动”以显式更新“启动模式”。
四安装 Microsoft .NET Framework 2.0 修补程序
1.在应用层计算机上,找到 Team Foundation Server 安装媒体上的 KB913393 文件夹。
2.找到与您的操作系统 (X86) 对应的可执行文件 (.exe),然后双击该文件进行安装。
五安装 Microsoft Windows SharePoint Services
要点
Windows SharePoint Services 需要使用 NTFS 文件系统。
1.使用 Team Foundation Server 安装帐户(例如 Domain\TFSSETUP)登录到 Windows。
2.在“安装类型”页上选择“服务器场”,然后单击“下一步”。
3.安装完成时,将打开一个 Web 浏览器窗口,并显示“配置管理虚拟服务器”页。确认该页显示后,不要进行任何更改,关闭该浏览器窗口。
4.重新启动计算机。
六验证 Windows SharePoint Services 安装
打开 Internet Explorer 并键入相应的服务器名称作为地址。
例如,对于名为 ADATUM 的服务器,应键入 Http://adatum。
虽然未配置站点,但服务器是活动 Web 服务器并提供“建设中”页面。
注意
在本地化版本的 Windows SharePoint Services 上安装 Team Foundation Server 之前,必须先安装与 Team Foundation Server 语言匹配的 Windows SharePoint Services 语言包。例如,如果计划安装本地化版本的 Windows SharePoint Services 和英文版的 Team Foundation Server,则必须在安装 Team Foundation Server 之前安装 Windows SharePoint Services 英语语言包。
七安装 Team Foundation Server
1.使用 Team Foundation Server 安装帐户(例如 Domain\TFSSETUP)登录到 Windows。
2.在“服务登录帐户”页上,在“帐户名”框中键入您为 Team Foundation Server 服务帐户创建的 Windows 域用户帐户(例如 Domain\TFSSERVICE),并在“密码”框中键入密码,然后单击“下一步”。
3.在“报告登录帐户”页上,键入 Team Foundation Server 报告帐户的帐户信息,此帐户不应与 Team Foundation Server 安装或服务帐户相同。例如,使用 Domain\TFSREPORTS。然后单击“下一步”。
4.在“指定警报设置”页上,选择“启用 Team Foundation 警报”,然后键入以下信息:
在“SMTP 服务器”框中,键入将用于发送电子邮件通知的服务器的名称。
在“发件人电子邮件地址”框中,键入作为通知来源的电子邮件地址的名称,然后单击“下一步”。
5.在 Internet Explorer 中,定位到 http://localhost:8080/services/v1.0/Registration.asmx,然后单击“GetRegistrationEntries”。
在“GetRegistrationEntries”页上单击“调用”。不必输入 ToolID。
注意
要使用此 Web 方法,您必须位于应用层计算机上。
在 XML 中,确认类型 VSTF 存在,然后关闭。例如:
<?xml version="1.0" encoding="utf-8" ?>
<Type>vstfs</Type>
双服务器部署
在数据层上
一安装 Microsoft SQL Server 2005
1.在数据层计算机上,使用 Team Foundation Server 设置帐户(例如 Domain\TFSSETUP)登录到 Windows。
2.在“要安装的组件”页上,选择下面的组件,然后单击“高级”。
SQL Server Database Services
Analysis Services
Integration Services
工作站组件、联机丛书和开发工具
注意
Reporting Services 应安装在应用层上。Team Foundation Server 不需要 Notification Services。
3.在“实例名”页上,选择“默认实例”,然后单击“下一步”。
4.在“服务帐户”页上,选择“使用内置系统帐户”并从列表中选择“本地系统”。在“安装结束时启动服务”中,选择所有服务:“SQL Server”、“SQL Server Agent”、“Analysis Services”和“SQL Browser”,然后单击“下一步”。
二安装 Microsoft SQL Server 2005 修补程序
1.在数据层计算机上,打开“SQL Server 配置管理器”,右击“SQL Server 浏览器服务”,然后单击“停止”。
2.在 Team Foundation Server 安装媒体上,找到 SQLServerKB 文件夹。
找到与您的操作系统和语言对应的可执行文件 (.exe),如 AS2005-KBnnnnnn-x86-ENU.exe,然后双击该文件以启动 Hotfix Installer(修补程序安装程序)。
3.在“SQL Server 配置管理器”中,右击“SQL Server Browser 服务”,然后单击“属性”。
在“服务”选项卡上找到“启动模式”,然后选择“自动”。
在“登录”选项卡上,单击“启动”。
注意
如果在“登录”选项卡上未启用“启动”,则单击“服务”选项卡,将“启动模式”设置为“禁用”,然后再次选择“自动”以显式更新“启动模式”。
三安装 Team Foundation Server 数据库
1.使用您在核对检查表时确定的 Team Foundation Server 设置帐户(例如 Domain\TFSSETUP)登录到 Windows。
2.查看 Team Foundation Server 数据库
从“开始”菜单上单击“程序文件”,再单击“Microsoft SQL Server 2005”,然后单击“SQL Server Management Studio”。
在“对象资源管理器”中,展开“数据库”并验证 Team Foundation Server 数据库是否存在。
将应用层配置为应用程序服务器
一安装IIS
1.请选择“ASP.NET”
2.不要选择“FrontPage 2002 Server Extensions”。
3.请验证是否已启用 ASP.NET,如果没有则启用。
二安装 SQL Server Reporting Services
1.在应用层计算机上,使用 Team Foundation Server 设置帐户(例如 Domain\TFSSETUP)登录到 Windows。
2.在“要安装的组件”页上,选择“Reporting Services”,然后单击“下一步”。
3.在“实例名”页上,选择“默认实例”,然后单击“下一步”。
4.在“服务帐户”页上,选择“使用内置系统帐户”并从列表中选择“网络服务”。在“在安装结束时启动服务”中,选择“Reporting Services”,然后单击“下一步”。
5.单击“完成”退出向导。
警告
不要使用 Reporting Services 配置工具检验服务是否正在运行。Team Foundation Server 安装向导为您配置 Reporting Services,打开该工具可能会阻止安装完成。
三验证 Reporting Services 安装
1.单击“开始”,单击“管理工具”,然后单击“服务”。
2.在“服务管理器”的“名称”列中找到“SQL Server Reporting Services”,并验证“状态”为“已启动”,“启动类型”为“自动”。
3.关闭“服务管理器”。
四安装 Microsoft .NET Framework 2.0 修补程序
1.在应用层计算机上,找到 Team Foundation Server 安装媒体上的 KB913393 文件夹。
2.找到与您的操作系统 (X86) 对应的可执行文件 (.exe),然后双击该文件进行安装。
五安装 Windows SharePoint Services
要点
Windows SharePoint Services 需要使用 NTFS 文件系统。
1.在应用层计算机上,使用 Team Foundation Server 设置帐户(例如 Domain\TFSSETUP)登录到 Windows。
2.在“安装类型”页上选择“服务器场”,然后单击“下一步”。
3.安装完成时,将打开一个 Web 浏览器窗口,并显示“配置管理虚拟服务器”页。确认该页显示后,不要进行任何更改,关闭该浏览器窗口。
4.重新启动计算机。
5.验证已安装 Windows SharePoint Services
打开 Internet Explorer 并键入相应的服务器名称作为地址。
例如,对于名为 ADATUM 的服务器,应键入 Http://adatum。
虽然未配置站点,但服务器是活动 Web 服务器并提供“建设中”页面。
六安装 Team Foundation Server (Services)
注意
如果正在本地化版本的 Windows SharePoint Services 上安装 Team Foundation Server,必须先安装与 Team Foundation Server 语言匹配的 Windows SharePoint Services 语言包。例如,如果计划安装本地化版本的 Windows SharePoint Services 和英文版的 Team Foundation Server,则必须在安装 Team Foundation Server 之前安装 Windows SharePoint Services 英语语言包。
1.在应用层计算机上,使用 Team Foundation Server 设置帐户(例如 Domain\TFSSETUP)登录到 Windows。
2.在“数据库服务器”框中,键入在其上安装 Team Foundation Server (databases) 的计算机的名称。
注意
必须使用计算机名,而不是 IP 地址。
3.在“服务帐户”页上,键入 Team Foundation Server 服务帐户(例如 Domain\TFSSERVICE)的帐户信息,然后单击“下一步”。
4.在“报告登录帐户”页上,键入 Team Foundation Server 报告帐户(例如 Domain\TFSREPORTS)的帐户信息,然后单击“下一步”。
注意
此帐户不应与 Team Foundation Server 安装或服务帐户相同。
5.在“Team Foundation 警报”页上,键入以下信息:
在“SMTP 服务器”框中,键入将用于发送 Team Foundation 警报的服务器的名称。
在“发件人电子邮件地址”框中,键入发送 Team Foundation 警报的电子邮件地址的名称,然后单击“下一步”。
注意
如果要在这里启用警报,就必须知道组织的 SMTP 服务器。对于仅 SMTP 访问,Team Foundation Server 不需要特殊的配置设置。
6.在 Internet Explorer 中,定位到 http://localhost:8080/services/v1.0/Registration.asmx,然后单击“GetRegistrationEntries”。
在“GetRegistrationEntries”页上单击“调用”。不必输入 ToolID。
注意
要使用此 Web 方法,您必须位于应用层计算机上。
在 XML 中,确认类型 VSTF 如此处所示,然后关闭。
<?xml version="1.0" encoding="utf-8" ?>
<Type>vstfs</Type>
3)客户端的安装:
安装Team Explorer时,需要经过两次重启才能安装完,期间在重启后要保证光驱中有安装盘,会自动继续安装的;安装完后还要重启一遍。
如果用Project2003访问TFS时,如果提示TF86002:lack of .NET Programmability Support in the Office Application.则要打开
Microsoft® Office Project Professional 2003 (English) 选择安装之后安装.NET Programmability Support就可以了。
用VS2005连接TFS时“Tools-Connection to Team Foundation Server-Servers-Add-Server name:填写安装有TFS的且在域里的电脑的计算机名如LJQ2”
4)如果用虚拟机做域控制器,如果此虚拟机所运行的操作系统文件是拷贝过来的,或者承载此虚拟机的操作系统被还原后,这些情况都可能导致以此虚拟机为域控制器的TeamFoundationServer的TFSServer域账号过期而使TFS服务启动失败。
解决办法:将将A电脑上的虚拟机上的操作系统(是域控制器并含有被TFS使用的TFSReporting和TFSService帐号)拷贝到另一个电脑B上,在B上启动此域控制器操作系统,在域控制器上将域用户的密码更新一遍(更新成和原来的一样),之后在A电脑上(装有TFS的电脑上)重新登陆一遍,此时TFS成功启动,这时将B上的域控制器拷贝到A电脑上,关B上的虚拟机,启动A电脑上的虚拟机域控制器(其间要选Create一个新的UUID为虚拟机),此时A上的TFS可用,如果此前A上的TFSServerScheduler服务已经停止则要先启动此服务才能使TFS可用。
2.怎样加测试的Test Case:
右键Work Items-Add Work Item:Test Case。或者打开Team Explorer-出现Team菜单-选Add Work Item。或者右键Work Items-选Add Work Item with Microsoft Excel-当打开Excel后,选Add-Ins,然后可以通过Choose Columns添加或删除需要给数据的field,它对应在vs中新建Test Case页中的每个文本框。
怎样配置新建Test Case的Area Path:
在vs上-Team-Team Project Settings-打开Areas and Iterations后可以加新节点或Rename。也可在Excel的Team菜单中选Edit Areas and Iterations来操作。
3.文件不同当你下载文件时,未Check Out时,Resolve Conflicts仅有Auto Merge选项。Check Out时,Resolve Conflicts会有Merge changes in merge tool选项,如果是非文本文件则此项是灰显。
4.使用TFS需要在VS的Tools-Options-Source Control里选TFS,否则在VS中的TFS的相关功能会灰显。
5.如果用别人的smart card登陆后,连接到TFS,check-in时会是smart Card的帐户,可以在打开VS之前run as成你的帐户,或者对于win7可以到Control Pannel-User Account-Certifical Mannagement-删除smart card帐户或者编辑-改到你的帐户。
IIS
1)发布站点后,访问页面提示下面错误:
错误:
Server Application Unavailable
The web application you are attempting to access on this web server is currently unavailable. Please hit the "Refresh" button in your web browser to retry your request.
Administrator Note: An error message detailing the cause of this specific request failure can be found in the application event log of the web server. Please review this log entry to discover what caused this error to occur.
解决:
如果你运行WinXP/IIS 5.1,为了给ASPNET工作进程访问你的web工程文件夹的权力请到网站文件所在的目录,右键一级文件夹,选Security-Add-键入“ASPNET”,点击OK或点击Check Names,如果弹出对话框提示“Name not Found”则应点击Locations改变位置到本机计算机名,点击OK,分配此用户权限为“Full Control”点击OK。
错误变为:
You are not authorized to view this page
You do not have permission to view this directory or page using the credentials you supplied.
解决:
在IIS里右键此虚拟目录-Properties-Directory Security-Edit-勾选上Integrated Windows authentication即可。
2)IIS上的asp.net version 只有2.0时的解决办法:
需要重新注册一下asp.net 1.1-在“Visual Studio .NET 2003(vs2005则是注册asp.net2.0)命令提示” 里输入“Aspnet_regiis.exe -i”,如果问题还是没有解决,可能是系统内还驻留有原来的注册,卸载 ASP.NET 1.1 的版本(Visual Studio .NET 2003 命令提示行里输入:“Aspnet_regiis.exe -u”),然后重新注册安装 ASP.NET 1.1版本,并启用 ASP.NET 1.1(在“Visual Studio .NET 2003 命令提示”里输入"Aspnet_regiis.exe -i -enable")
(3)
将IIS站点由一台电脑迁移到另一个电脑的的方法是:
1.将源电脑上的站点文件拷贝到目标电脑的相同盘符下。
2.备份源站点配置:在IIS管理器中右键根结点,选择所有任务-备份还原配置。备份时
一定要设置密码,否则在另一个电脑上恢复的时候会抛错误“空间不足”或“无效的名字”
3.由C:\WINDOWS\system32\inetsrv\MetaBack拷贝两个备份文件到目标机器的相同位置。
4.在目标机器上恢复此备份。
http://blog.163.com/tangbotb82/blog/static/11891166920095224350847/
(4)如果IIS遇到Server Unavailable的问题,则需要将App Pool里的帐户加到IIS_WPG组里。
测试
(1)LoadRunner8.1既可以装在Windows Server 2003上也可以装在XP上,但系统最好是刚刚装的,不要装其他软件,好像尤其不能装VS2005,否则不能安装成功。
LoadRunner7.8和LoadRunner8.0的破解协议是通用的,LoadRunner8.1的破解可以通过拷贝C:\Program Files\Mercury\LoadRunner\bin里的LoadRunner7.8或LoadRunner8.0的lm70.dll和mlr5lprg.dll来覆盖LoadRunner8.1的实现破解。
安装前可以先把当前时间后退到以前的一年,安装中输入破解的协议,安装后恢复当前时间,这样LoadRunner的协议就只有一个被破解的协议而那个试用版本的协议就没了。但如果没这样设置而有那个试用版的协议也不要紧,等到过期后LoadRunner会自动使用那个被破解的协议。
(2)开发人员编码后进行“单元测试”,主要测试单个功能点是否正确。
完成“单元测试”后,也就是整个系统编码完成后,再进行“集成测试”,主要是看功能点之间的衔接是否正确。
在“单元测试”和“集成测试”中都可能发现问题,对这些问题修改后还要进行“回归测试”,主要是看这些问题是否修改正确了,对其他的部分是否有影响。其实仅单纯从英文单词Regress很好理解:return to a worse or less developed state.即是退化,衰退的意思,检查软件从正常的稳定状态退化或是衰退到不正常工作的不稳定状态。
“验收测试”是在客户方进行的测试,由用户进行。
(3)
代码覆盖率
http://www.cnblogs.com/coderzh/archive/2009/03/29/1424344.html
http://www.51testing.com/html/32/n-201032.html
Ad Hoc测试
http://wcx337.blog.sohu.com/99662113.html
Ad Hoc Testing,Cross Testing,Smoke Testing
http://wcx337.blog.sohu.com/99661793.html
http://msdn.microsoft.com/zh-cn/ms182613(VS.80).aspx
Analyze and Get Solution
Impact Analysis
Write Design Doc + Review
Coding + Unit Testing + Review
Drop Package + Smoke Testing + Rework
Integration Testing + Ad Hoc Testing + Rework
Buffer
(4)构建验证测试(BVT)即冒烟测试
http://www.cnblogs.com/mayingbao/archive/2006/04/25/384166.html
http://www.51testing.com/?uid-135854-action-viewspace-itemid-202111
Bug Bash的来源与意义
http://hi.baidu.com/angel7212/blog/item/3675ba18bbefc64d43a9ad31.html
http://www.cnblogs.com/pent/archive/2008/06/17/1223811.html
End to End Testing
端到端架构测试(End to End Architecture Testing)指的是这样一种概念,它测试计算环境中所有的访问点,并在组件级和系统级的测试中将功能测试和性能测试整合在一起。
从某种意义上来说,端到端架构测试实质上是一种"灰盒"测试,一种集合了白盒测试和黑盒测试的长处的测试方法。
对可伸缩性测试和性能测试来说,访问点包括硬件、操作系统、应用程序数据库和网络。对功能测试来说,访问点包括前端的客户端,中间层,内容源和后台数据库。
http://yishan.cc/blogs/lilei105/archive/2007/05/17/end-to-end.aspx
Software Process & QA 软件开发管理与质量保障
http://blogs.msdn.com/jeffwang/
(5)
解决方案和案例
http://www.microsoft.com/china/technet/itsolutions/default.mspx
http://www.microsoft.com/china/technet/itsolutions/migration/unix/umpg/default.mspx
http://www.microsoft.com/china/casestudies/
http://www.microsoft.com/china/business/default.mspx
http://www.microsoft.com/china/smb/local/successfulstories/default.aspx
(6)POC,是Proof of Concept的缩写,意思是为观点提供证据,它是一套建议的电子模型,它可用于论证团队和客户的设计,允许评估和确认概念设计方案,POC的评价可能引起规格和设计的调整。
MOSS开发:
(1)
问题:
访问http://hcsserver:9001/时候,页面出现错误为:
返回网站
错误
此网页存在致命错误。如果问题持续存在,请与系统管理员联系。
Windows SharePoint Services 疑难解答。
原因:
在C:\Inetpub\wwwroot\wss\VirtualDirectories\9001中的web.config文件的内容
<SafeControls>
<SafeControl ~~~~~~/>
</SafeControls>
被修改的不正确,比如Safe写成Sage或少了“,”
解决方法:
将web.config修改正确,重启IIS的相应站点和应用程序池
由此想到的:
WSS属于2次开发,这些原始代码不能直接去修改,如果修改则要有版本控制。
我的解决方安:
1.WSS的原始代码上传到TFS
2.IIS上运行的WSS代码由TFS下载得到
3.任何人对WSS源码的修改,都只能签出TFS的代码作修改,之后上传,之后再将IIS的代码作同步。
(2)
当IIS上的SharePoint - 9091站点被删除后的恢复办法:
打开SQL Server Configuration Manager-停掉SQL Server-再打开其-copy出WSS_Content数据库-删掉WSS_Content数据库打开MOSS的管理中心-应用程序管理-创建或扩展web应用程序,创建新的9091站点-将现在的WSS_Content数据库换成刚刚拷贝的数据库,可以直接替换或通过备份恢复-在MOSS的“管理中心”的“应用程序管理”的“内容数据库”中-删掉现有的WSS_Content,再添加以前的WSS_Content,一切OK,可能需要用老的文件再覆盖一下现在的文件。
(3)
Infopath表单发布成表单库时让Browser可用的注意事项:
1.网站操作-网站设置-修改所有网站设置-网站功能:激活“Office SharePoint Server 企业版网站集功能”
2.发布时勾选“Enable this form to be filled out by using a browser”
Infopath表单用作工作流的注意事项:
1.Tools-Form Options-Security and Trust,选择Domain或Full Trust后工作流才可用。如果表单用了Full Trust而双击打不开时,则右键.xsn文件选择Design。
2.Infopath表单保存的文件名和发布的文件名应该一致,因为MOSS用的是发布后的文件而ID内的某段单词是保存的文件名。
3.如果使用了Contact Selector控件,则在数据源里要加组Person和域DispalyName、AccountId、AccountType,注意组名和域名必须写的正确且区分大小写,还要加名为Context.xml的文件其内容为<Context siteUrl="http://myserver/">。此规定可在Contact Selector Properties里的Items里找到。
手动配置MOSS工作流:
1.右键工程文件-Properties-“Build Events”->“Post-build event command line”改变“NODEPLOY”到“DEPLOY”
2.右键工程文件-Properties-“Signing”-勾选“Sign the assembly”-选下拉菜单的“New”,不要加密码。
3.配置feature.xml:
Id的获得VS2005-Tools-Create GUID,选4.Registry Formagt,点击Copy-黏贴到feature.xml文件的Id处。
有可能需要删掉或修改feature.xml内的<ElementFile Location="MyForm.xsn"/>
其中“Title”,“Description”可以修改。<Property Key="RegisterForms" Value="*.xsn" />用于注册Infopath表单。
4.配置workflow.xml:
“Name”,“Description”可修改。
“Id”,“CodeBesideClass”,“CodeBesideAssembly”必须修改。
获得.dll文件的公钥标记的方法C:\Program Files\Microsoft Visual Studio 8\VC>sn -T "C:\Documents and Settings\jqli.HSLCN\Desktop\MOSS\SequentialWorkflow\SequentialWorkflow\bin\Debug\SequentialWorkflow.dll"
ModificationUrl="_layouts/ModWrkflIP.aspx"依照情况删掉。
<Association_FormURN>associationFormURN</Association_FormURN>,<Instantiation_FormURN>instantiationFormURN</Instantiation_FormURN>,<Task0_FormURN>taskFormURN</Task0_FormURN>需修改。
如果想增加一个Task表单则添加<Task1_FormURN>并且在代码中用createTask1_TaskProperties1.TaskType = 1;指定任务与表单的关系。
依照情况删除<Modification_GUID_FormURN>modificationURN</Modification_GUID_FormURN>和<Modification_GUID_Name>Name of Modification</Modification_GUID_Name>
URN的获得-打开Infopath表单-转到编辑状态(Tools-Design This Form)-在设计窗口中点击File-Properties-拷贝ID里的文本内容。
5.拷贝所有用到的Infopath表单到项目文件的~\DeploymentFiles\FeatureFiles内。
6.自动发布工作流到MOSS则修改PostBuildActions.bat文件内的所有http://localhost为正确的地址后,Build一下工程文件则工作流发布成功。也可以手动发布,如下。
手动安装MOSS工作流:
1.拷贝dll文件到GAC中,在C:\WINDOWS\assembly里面或Start-Administrative Tools-Microsoft .Net Framework 2.0 Configuration
2.拷贝项目文件的~\DeploymentFiles\FeatureFiles内的配置文件和表单文件到C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\内。
3.可以先验证一下表单,执行C:\Program Files\Microsoft Visual Studio 8\VC>"C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\STSADM.EXE" -o verifyformtemplate -filename "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\
TEMPLATE\FEATURES\SequentialWorkflow\testTmpl.xsn"
再执行
C:\Program Files\Microsoft Visual Studio 8\VC>"C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\STSADM.EXE" -o installfeature -filename "SequentialWorkflow\feature.xml" -force
再执行
C:\Program Files\Microsoft Visual Studio 8\VC>"C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\STSADM.EXE" -o activatefeature -filename "SequentialWorkflow\feature.xml" -url http://localhost:9091
4.此时“网站设置>网站功能”内能看到工作流且已激活。“Central Administration > Application Management > Manage Form Templates”内能看到Infopath表单且Status为Ready,Workflow Enabled为yes
5.执行iisreset
6.显示工作流表单时,如果出现以下问题:“The form cannot be displayed because the session state is not available”或“该表单无法显示,因为会话状态不可用”
解决方法:在网站的web.config中的httpmodules一节增加<add name="Session" type="System.Web.SessionState.SessionStateModule"/>
手动卸载MOSS工作流:
1.停用“~>网站设置>网站功能”内的相应工作流
可先执行C:\Program Files\Microsoft Visual Studio 8\VC>"C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\STSADM.EXE" -o deactivatefeature -filename "SequentialWorkflow\feature.xml" -url http://localhost:9091
再执行
C:\Program Files\Microsoft Visual Studio 8\VC>"C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\STSADM.EXE" -o uninstallfeature -filename "SequentialWorkflow\feature.xml"
2.此时“Central Administration>Application Management>Manage Form Templates”内的Infopath模版也已经卸载掉。
3.卸载“C:\WINDOWS\assembly”内的dll
4.删除“C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\”内的相应文件。
(4)
WebPart开发:
1.要在WebPart工程的AssemblyInfo.cs文件中添加“[assembly: System.Security.AllowPartiallyTrustedCallers()]”,以便在MOSS中能正确使用此WebPart。
把WebPart编译后的.dll文件放到C:\Inetpub\wwwroot\wss\VirtualDirectories\9091\bin里面或放到GAC即C:\WINDOWS\assembly里面。
2.把UserControl的.ascx文件可放到任意地方如C:\Inetpub\wwwroot\wss\VirtualDirectories\9091\bin,如果UserControl的C#的代码没有放到.ascx文件里,而是采用的后置代码形式,则应该将编译后的UserControl的.dll文件也放到MOSS站点中。
如果UserControl建立在ASP.NET Web Site工程里,则通过右键工程选“Publish Web Site”-勾选“Allow this precomplied site to be updatable”和“Use fixed naming and single page assemblies”-点“OK”,将发布得到的.dll文件放到C:\Inetpub\wwwroot\wss\VirtualDirectories\9091\_app_bin里面。.ascx文件可放到任意地方。
如果UserControl建立在ASP.NET Web Application工程里,则通过编译工程后在Bin目录中得到的.dll文件,将其放到C:\Inetpub\wwwroot\wss\VirtualDirectories\9091\bin里面。.ascx文件可放到任意地方。
3.为了添加WebPart到MOSS站点,在C:\Inetpub\wwwroot\wss\VirtualDirectories\9091中的web.config文件中的<SafeControls>里面添加一句<SafeControl Assembly="HRManagementWP" Namespace="HRManagementWP" TypeName="*" Safe="True" />
为了使MOSS有权限访问C:\Inetpub\wwwroot\wss\VirtualDirectories\9091\bin目录中的UserControl的.dll等文件,把<trust level="WSS_Minimal" originUrl="" />修改为<trust level="Full" originUrl="" />
(5)
Microsoft® Visual Studio® 2005 Team Suite Service Pack 1
在开始SP1更新前,假如你在你系统上安装了那个单独的VS 2005 Web应用项目的话,确认你将它卸载了。你不再需要它了,因为它的支持是内置于SP1中的,假如你安装了它的话,SP1安装程序会停止,让你将它卸载了才会继续下去。你现有的web应用项目文件还会继续工作,所以你对它们不需要做什么更新。
http://www.microsoft.com/downloads/details.aspx?FamilyId=BB4A75AB-E2D4-4C96-B39D-37BAF6B5B1DC&displaylang=en
安装vs05 sp1时遇到“Error 1718. File was rejected by digital signature policy”错误的解决办法:
http://support.microsoft.com/kb/925336/zh-cn
Visual Studio 2005 Web 应用程序项目
http://msdn2.microsoft.com/zh-cn/asp.net/Aa336618.aspx
为了在 Visual Studio 2005 中完全启用 Web 应用程序项目,必须首先安装 Microsoft Visual Studio 2005 – 更新到支持 Web 应用程序项目(Microsoft Visual Studio 2005 - Update to Support Web Application Projects),然后再安装此外接程序。
Microsoft Visual Studio 2005 - Update to Support Web Application Projects
http://www.microsoft.com/downloads/details.aspx?familyid=8B05EE00-9554-4733-8725-3CA89DD9BFCA&displaylang=en
Windows SharePoint Services 3.0: Software Development Kit (SDK):
http://www.microsoft.com/downloads/details.aspx?familyid=05E0DD12-8394-402B-8936-A07FE8AFAFFD&displaylang=en
Windows SharePoint Services 3.0 Tools: Visual Studio 2005 Extensions:
http://www.microsoft.com/downloads/details.aspx?familyid=19f21e5e-b715-4f0c-b959-8c6dcbdc1057&displaylang=en
Visual Studio 2005 extensions for .NET Framework 3.0 (Windows Workflow Foundation):
http://www.microsoft.com/downloads/details.aspx?familyid=5D61409E-1FA3-48CF-8023-E8F38E709BA6&displaylang=en
SharePoint Server 2007 SDK: Software Development Kit
http://www.microsoft.com/downloads/details.aspx?familyid=6d94e307-67d9-41ac-b2d6-0074d6286fa9&displaylang=en
Microsoft? Windows? Workflow Foundation Runtime Components Beta 2.2 and Visual Studio? 2005 Extensions for Windows Workflow Foundation Beta 2.2:
http://www.microsoft.com/downloads/details.aspx?familyid=5c080096-f3a0-4ce4-8830-1489d0215877&displaylang=en#filelist
2007 Office System Starter Kit: Enterprise Content Management Starter Kit:
http://www.microsoft.com/downloads/details.aspx?FamilyID=38ca6b32-44be-4489-8526-f09c57cd13a5&displaylang=en
Windows SharePoint Services 3.0 Starter Kit: Workflow Developer Starter Kit for Windows SharePoint Services 3.0:
http://www.microsoft.com/downloads/details.aspx?familyid=5DDF902D-95B1-4640-B9E4-45440DC388D9&displaylang=en
Windows SharePoint Services 3.0 Application Templates: All Templates
http://www.microsoft.com/downloads/details.aspx?familyid=5807b5ef-57a1-47cb-8666-78c1363f127d&displaylang=en&tm
Application Templates for Windows SharePoint Services 3.0
http://www.microsoft.com/technet/windowsserver/sharepoint/wssapps/templates/default.mspx
SharePoint Products and Technologies Templates: Web Part Templates for Visual Studio .NET (好像用于VS2003):
http://www.microsoft.com/downloads/details.aspx?FamilyID=cac3e0d2-bec1-494c-a74e-75936b88e3b5&DisplayLang=en
海洋工作室:
http://www.oceanstudio.net/default.aspx
海洋邮箱:
v-haiju@microsoft.com
Erucy's blog
http://blog.joycode.com/erucy/
陈老师博客:
http://blog.joycode.com/choral/
11大哥博客:
http://sps.dnngo.com/Blog/default.aspx
兰竹菊梅博客:
http://www.cnblogs.com/foundation/articles/515615.html
彦斌博客:
http://blog.sina.com.cn/s/blog_4925e2f901000ati.html 用loadcontrol的方式来加载webpart
http://blog.sina.com.cn/s/blog_4925e2f901000a23.html Moss2007搜集来的资料
Andrew Connell博客:
http://www.andrewconnell.com/blog/articles/MossWcmResources.aspx#MasterPagesPageLayouts
Office中文官网
http://office.microsoft.com/zh-cn/2007/FX100649542052.aspx?ofcresset=1
Office英文官网
http://office.microsoft.com/en-us/FX100647101033.aspx?pid=CL100569831033
Visual Studio 2005 Tools for Office Second Edition视频教程:
http://msdn2.microsoft.com/en-us/office/aa905543.aspx
2007 Office System Video: Enterprise Content Management:
http://www.microsoft.com/downloads/details.aspx?familyid=562b9b75-55b7-4f5d-afe4-1f78c8b7fc6d&displaylang=en#filelist
如何最方便的创建SharePoint解决方案包:
http://blog.joycode.com/choral/archive/2007/06/15/104276.aspx
SharePoint 2003 + VS2003 WebPart 开发
http://www.devx.com/dotnet/Article/17518
Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's)
http://www.andrewconnell.com/blog/articles/UsingVisualStudioAndMsBuildToCreateWssSolutions.aspx
模板:SharePoint2007解决方案包
http://blog.joycode.com/choral/archive/2007/01/17/91647.aspx
SharePoint2007 Solution Generator
http://weblogs.asp.net/soever/archive/2006/11/11/SharePoint-Solution-Generator-_2D00_-part-1_3A00_-create-a-site-definition-from-an-existing-site.aspx
Visual Studio 2005 extensions for Windows SharePoint Services 3.0 图解
http://blog.joycode.com/choral/archive/2006/11/17/86698.aspx
SharePoint Developer Explorer - Visual Studio Add-in
http://blog.thekid.me.uk/archive/2007/10/15/sharepoint-developer-explorer-visual-studio-add-in.aspx
“增补\For IT Professionals\Office\SharePoint Portal Server 2003\SharePoint Portal Server 2003 WebPart 开发msft021506vxpm.zip”
在vs2003下开发SharePoint2003时候,制作和使用Webpar的.cab安装包。开发Webpart时怎样调试。
MOSS 解决方案包WSP:
http://www.cnblogs.com/wanghao-3/archive/2007/07/12/815563.html
一步一步SharePoint 2007:
http://www.winos.cn/forum/viewthread.php?tid=5397
MOSS 2007安装与部署
http://xugang.blog.51cto.com/400032/116019
SharePoint 2003安装步骤
http://www.cnblogs.com/payche/archive/2007/04/27/729653.html
http://www.cnblogs.com/applengine/archive/2006/01/19/320266.aspx
http://blog.donews.com/ynzf/archive/2006/09/27/1048182.aspx
让用户控件包装器“见鬼”去:
http://www.cnblogs.com/wanghao-3/archive/2007/08/13/853207.html
SharePoint WebPart开发实战(一):定制属性及配置界面:
http://blog.csdn.net/jackjoy/archive/2007/08/05/1727745.aspx
QuickPart:
http://www.codeplex.com/quickpart
http://blog.joycode.com/kaneboy/articles/89144.aspx
六步实现Sharepoint+QuickPart+Ajax
http://taglib.cn/story.php?title=%e5%85%ad%e6%ad%a5%e5%ae%9e%e7%8e%b0sharepointquickpartajax
UpdatePanel在Quickpart中的应用
http://jlj80.spaces.live.com/blog/cns!B14C4E651E0B0354!213.entry
SharePoint多级审批工作流开发文档[Sequential版] v1.1
http://www.cnblogs.com/xiaoshatian/archive/2007/09/03/657181.html
MOSS工作流开发+Email提醒:
http://www.cnblogs.com/wanghao-3/archive/2007/06/26/795844.html
针对开发人员的 Windows SharePoint Services V3 和 SharePoint Server 2007 工作流简介:
http://www.microsoft.com/china/MSDN/library/Office/sharepoint/ms406057.mspx?mfr=true
Office SharePoint Server2007开发入门指南
http://book.csdn.net/bookfiles/476/10047616654.shtml
Visual Studio.net 2005 新建项目对话框中项目模版消失的解决方案:
http://www.cnblogs.com/xiaoshatian/archive/2006/12/14/592464.html
MOSS工作流开发入门学习:
http://www.cnblogs.com/wanghao-3/archive/2007/06/28/799238.html
因为Windows SharePoint Services和用户通过Web浏览器通讯,所以它依靠ASP.NET显示表单。这些表单被定义为ASPX页面。一个Windows SharePoint Services的工作流可以在流程生命周期中的4个地方显示自己的表单:
n 关联:When a Windows SharePoint Services administrator associates a workflow template with a particular document library or list, he might be able to set options that will apply to every workflow instance created from this association. If a workflow author chooses to allow this, she must provide a form that lets the administrator specify this information.
n 初始化:: The initiator of a workflow might be allowed to specify options when he starts a running instance. In the approval scenario just described, for instance, the options included specifying the list of workflow participants and defining how long each one had to complete his or her task. If a workflow allows this, its author must provide a form to allow the initiator to set these options, as shown in step 3 of the previous diagram.
n 完成任务:Task Completion: The running workflow instance must display a form to the participants in the workflow to let them complete their task. Shown in step 6 in the previous diagram, this form is what allowed the approvers in the earlier scenario to make comments on the document and indicate their approval or rejection.
n 修改任务:Modification: Although it wasn’t shown in the scenario above, the creator of a workflow can allow it to be modified while it’s running. For example, a workflow might allow adding new participants after it’s begun executing or extending the due date for completing tasks. If this option is used, the workflow must display a form at this point to let a participant specify what changes should be made.
WF’s Base Activity Library provides a group of fundamental activities, as described earlier. Windows SharePoint Services also provides a set of activities designed expressly for creating Windows SharePoint Services workflows. Among the most important of these are the following:
n OnWorkflowActivated: provides a standard starting point for a Windows SharePoint Services workflow. Among other things, this activity can accept information supplied by a Windows SharePoint Services administrator via the Association form when the workflow is associated with a document library or list. It can also accept information supplied via the Initiation form when the workflow is started. Every Windows SharePoint Services workflow must begin with this activity.
n CreateTask: creates a task assigned to a particular user in a task list. For example, the approval workflow in the scenario described earlier used this activity to add a task to the task list used by each of the participants. This activity also has a SendEmailNotification property that, when set to true, automatically sends an email message to the person for whom this task was created.
n OnTaskChanged: accepts information from the Task Completion form. The approval workflow in the earlier scenario used this activity to accept the input of each participant when the document was approved.
n CompleteTask: marks a task as completed.
n DeleteTask: removes a task from a task list.
n OnWorkflowModified: accepts information from the Modification form, which can then be used to change how this instance of the workflow behaves. If the workflow’s creator chooses not to include any instances of this activity in the workflow, that workflow cannot be modified while it’s running.
n SendEmail: sends email to a specified person or group of people.
n LogToHistoryList: writes information about the workflow’s execution to a history list. The information in this list is used to let users see where a workflow is in its execution, look at the workflow’s history after it’s completed, and more. To allow this kind of monitoring, the workflow’s author must write information to a History list at appropriate points in the workflow’s execution. Because it provides its own mechanism for tracking workflows, Windows SharePoint Services doesn’t support WF’s standard tracking service.
A typical pattern for a simple Windows SharePoint Services workflow begins with an OnWorkflowActivated activity, then uses a CreateTask activity to assign a task to a participant in the workflow. The BAL’s standard While activity might then be used to wait until the user completes the task. To learn when this has happened (perhaps the user makes multiple changes to the task, then checks a box on the Task Completion form when she’s done), an OnTaskChanged activity executes within the While, extracting whatever information the user has entered on that form. When the user has completed the task, a CompleteTask activity might execute, followed by a DeleteTask. The workflow can then go on to the next participant, using CreateTask to assign a task to him, and so on. And of course, other things can occur, such as sending email, logging information to the history list, or even including the BAL’s Code activity, which allows running arbitrary code.
(5)
40 Template Install:
*********************************************************
APPLICATION TEMPLATES FOR WINDOWS SHAREPOINT SERVICES 3.0
*********************************************************
=========================================================
To install the Application Template Core solution:
=========================================================
C:\Documents and Settings\jqli.HSLCN>"C:\Program Files\Common Files\Microsoft Sh
ared\web server extensions\12\BIN\STSADM.EXE" -o addsolution -filename "C:\Docum
ents and Settings\jqli.HSLCN\Desktop\New Folder\ApplicationTemplateCore.wsp"
Operation completed successfully.
C:\Documents and Settings\jqli.HSLCN>"C:\Program Files\Common Files\Microsoft Sh
ared\web server extensions\12\BIN\STSADM.EXE" -o deploysolution -name "Applicati
onTemplateCore.wsp" -allowgacdeployment -immediate
Timer job successfully created.
Please specify either '-immediate' or '-local' or '-time' parameter.
C:\Documents and Settings\jqli.HSLCN>"C:\Program Files\Common Files\Microsoft Sh
ared\web server extensions\12\BIN\STSADM.EXE" -o copyappbincontent
=========================================================
To install an Application Template:
=========================================================
C:\Documents and Settings\jqli.HSLCN>"C:\Program Files\Common Files\Microsoft Sh
ared\web server extensions\12\BIN\STSADM.EXE" -o addsolution -filename "C:\Docum
ents and Settings\jqli.HSLCN\Desktop\New Folder\RoomEquipmentReservations.wsp"
Operation completed successfully.
C:\Documents and Settings\jqli.HSLCN>"C:\Program Files\Common Files\Microsoft Sh
ared\web server extensions\12\BIN\STSADM.EXE" -o deploysolution -name "RoomEquip
mentReservations.wsp" -allowgacdeployment -immediate
Timer job successfully created.
=========================================================
Instructions for use:
=========================================================
1. Log into your SharePoint site as the site
Administrator.
2. From the Site Actions drop-down menu in the top right,
select Site Settings.
3. Under the Site Administration section, select Sites
and Workspaces.
4. Select Create to create a new site using a site
template.
5. Complete the new SharePoint site information. In the
Template Selection section, select the Application
Templates tab. All deployed Application Template will
be listed in this tab.
6. Select the template to use for this site and click
Create.
7. A site has now been created using the application
template.
*********************************************************
APPLICATION TEMPLATES FOR WINDOWS SHAREPOINT SERVICES 3.0
*********************************************************
=========================================================
To install this download:
=========================================================
4. Log into your SharePoint site as the site Administrator.
5. From the Site Actions drop-down menu in the top right,
select Site Settings.
6. Under the Galleries section, select Site templates.
7. Select Upload to load an application template into this
SharePoint site.
8. Browse to the <template_name>.stp file from the distribution
and select Open. If you have several application templates
to load into your site, you can use the Upload Multiple
Files?option to load them all at once.
=========================================================
Instructions for use:
=========================================================
1. Log into your SharePoint site as the site Administrator.
2. From the Site Actions drop-down menu in the top right,
select Site Settings.
3. Under the Site Administration section, select Sites and
Workspaces.
4. Select Create to create a new site using a site template.
5. Complete the new SharePoint site information. In the
Template Selection section, select the Custom tab. Any
application templates that have been uploaded will be
listed here.
6. Select the template to use for this site and click Create.
(6)
Install SharePoint Server 2007 on Windows Server 2008 R2
http://blogs.msdn.com/b/sharepoint/archive/2009/10/02/install-sharepoint-server-2007-on-windows-server-2008-r2.aspx
Announcing Service Pack 2 for Office SharePoint Server 2007 and Windows SharePoint Services 3.0
http://blogs.msdn.com/b/sharepoint/archive/2009/04/28/announcing-service-pack-2-for-office-sharepoint-server-2007-and-windows-sharepoint-services-3-0.aspx
WebPart开发:
Anonymous Personalization Trick in Web Parts:
http://www.codeproject.com/aspnet/anonywebparts.asp
SharePoint2003开发:
1)SharePoint2003开发调试:
Debug-Processes-双击w3wp.exe-选择"Common Language Runtime" and "Script" 即可开始调试。不用修改根目录下的web.config。
2)SharePoint2003某个站点的备份
smigrate.exe -w http://msatwork/ -u redmond\mcwservp -f e:\MSATWORKProd.fwp -y
SharePoint2003某个站点的恢复
smigrate.exe -r -w http://%3c%3cwebserver%3e%3e/servicesprojects -u fareast\v-jasl -f C:\CMS_BACKUP\CMSSite.fwp
3)部署WebPart的dll到SharePoint2003时,不强签名也可以部署。
部署自定义站点到SharePoint站点时候,要先在IIS上欲创建SharePoint站点的IIS站点下部署好自定义的虚拟目录,之后再在IIS上创建SharePoint站点才能使自定义站点能正常访问。
4)部署Webpart时候出现下面的问题:
Request for the permission of type 'Microsoft.SharePoint.Security.SharePointPermission,
Microsoft.SharePoint.Security, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' failed.
By default WSS/MOSS is configured with a security policy called WSS_Minimal. This policy definition doesn't
grant access to the SP object model.
The simplest approach to enable access is to modify the web.config file in the virtual directory root for
your site and change the following tag
<trust level="WSS_Minimal" originUrl="" />
to
<trust level="WSS_Medium" originUrl="" />
The difference between Minimal and Medium is the addition of SharePoint object-model access and access to the NT event log.
也可修改到<trust level="full" originUrl="" />
http://msdn.microsoft.com/zh-cn/library/dd583158(en-us).aspx
5)
SharePoint2003过一段时间在本机不能访问的原因:
1.看看IIS的应用程序池帐户是否过期
2.看看Services里的服务帐户是否过期和停止
3.看看是否因为给SharePoint升级后,先前的SharePoint站点的版本已经是旧的了。
用命令
C:\Program Files\Common Files\Microsoft Shared\web server extensions\60\BIN>stsadm.exe -o upgrade -url http://asmbtvm28:81/
来升级站点。
SharePoint2003不能远程访问的原因:
因为Windows Firewall阻止。可以通过把你的站点的端口(TCP)加到防火墙的Exceptions里来解决。
Mobile开发: Windows Mobile Developer Power Toys:
http://www.microsoft.com/downloads/details.aspx?FamilyID=74473FD6-1DCC-47AA-AB28-6A2B006EDFE9&displaylang=en#filelist Office开发: 1)
Microsoft Visual Studio Tools for the Microsoft Office system (version 3.0 Runtime) (x86)。运行使用 Microsoft Visual Studio 2008 生成的面向 2007 Microsoft Office system 的 VSTO 解决方案时需要该库。
http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=54eb3a5a-0e52-40f9-a2d1-eecd7a092dcb Microsoft Visual Studio 2005 Tools for the 2007 Microsoft Office System (also known as “Visual Studio 2005 Tools for Office Second Edition” or “VSTO 2005 SE”),
这个不同于Microsoft Visual Studio 2005 Tools for Office Second Edition Runtime (VSTO 2005 SE) (x86),这个要装完vs2005才能装,应该是vs2005的项目板。这个是安装在vs2005上而不是vs2003上,好像没有安装在vs2003上的软件。安后会在vs2005上有office2003和office2007的模板:
http://www.microsoft.com/downloads/details.aspx?familyid=5e86cab3-6fd6-4955-b979-e1676db6b3cb&displaylang=en
Microsoft Visual Studio 2005 Tools for Office Second Edition Runtime (VSTO 2005 SE) (x86)。这个是给用vs2005开发的office软件安装时提供运行时环境,不用安装vs2005就可以安装。
Microsoft Visual Studio 2005 Tools for Office Second Edition Runtime (build 8.0.50272.940) (x86) 是VSTO 2005 SE的build版本。
http://www.microsoft.com/downloads/details.aspx?familyid=F5539A90-DC41-4792-8EF8-F4DE62FF1E81&displaylang=en
2)
在 Visual Studio 中创建 Office 解决方案
http://msdn2.microsoft.com/zh-cn/library/3295w01c(VS.80).aspx
Visual Studio Tools for Office 项目模板概述
http://msdn2.microsoft.com/zh-cn/library/8553caee(VS.80).aspx
产品组合可用的功能
http://msdn2.microsoft.com/zh-cn/library/aa942839(VS.80).aspx
Office 解决方案开发概述
http://msdn2.microsoft.com/zh-cn/library/hy7c6z9k(VS.80).aspx
3)命名空间Microsoft.Office.Interop.Word不存在的解决办法:
首先确保.NET Programmability Support(.net可编程支持)已经安装。如未安装则,再次运行office安装程序,选择“添加或删除组件”,->勾选“高级自定义应用程序”,->展开特定于应用程序的节点。例如,要获取 Microsoft Office word 2003 PIA,请展开 Microsoft Office word 节点并选择 .NET Programmability Support(.net可编程支持)。单击 .NET Programmability Support (.net可编程支持)旁边的下拉箭头以选择更新选项,并选取 Run from My Computer(从本机运行)。然后点击“更新”按钮。
在VS2005中右键项目->添加引用->COM->
Microsoft Office 11.0 object Library
Microsoft Word XX.X Object Library
(4)
using Excel = Microsoft.Office.Interop.Excel;报错。
添加COM引用,包括:Microsoft.Excel.x.0.Object.Library,Microsoft.Office.x.0.Object.Library
建议安装正版OFFICE,而且版本在11.0以上(Office2003以上),引用以上两个Com后,在项目引用栏发现多了Excel、Microsoft.Office.Core,VBIDE三个 Library.
| Office 2003 应用程序或组件 |
主 Interop 程序集名 |
主 Interop 程序集命名空间 |
| Microsoft Office 11.0 Object Library |
Office.dll |
Microsoft.Office.Core |
| Microsoft Excel 11.0 Object Library |
Microsoft.Office.Interop.Excel.dll |
Microsoft.Office.Interop.Excel |
| Microsoft Word 11.0 Object Library |
Microsoft.Office.Interop.Word.dll |
Microsoft.Office.Interop.Word |
(5)
Object reference not set to an instance of an object.
The problem is in first line of your code snippet at:
ApplicationClass ex = null;
You should try to modify it in style:
ApplicationClass ex = new ApplicationClass();
Or use:
Excel.Application xlApp = new Excel.Application();
(6)Old format or invalid type library. (Exception from HRESULT: 0x80028018 (TYPE_E_INVDATAREAD))
http://social.msdn.microsoft.com/Forums/en-US/Vsexpressvb/thread/4565361b-aeff-4d01-af92-d21a6eb631e3
http://msdn.microsoft.com/en-us/library/aa168494(office.11).aspx
(7)
Web+Office的开发
服务器端 Office 自动化注意事项
http://support.microsoft.com/kb/257757/zh-cn
"Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005. “
http://blog.crowe.co.nz/archive/2006/03/02/589.aspx
需要配置App Pool为管理员帐号而不是Network Service。
"Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80080005."
配置DCOM的权限不起作用。其原因是有多个OUTLOOK.exe进程。机器上不能打开Outlook软件。
项目内不需要引用Microsoft.Office.Interop.Outlook或Microsoft.Office.Interop.Word,因为服务器端必须装Office的.Net Programming Component,代码才能new出office对象。
(8)
How Do I: Deploy a VSTO Add-In?
http://msdn.microsoft.com/en-us/office/bb851702.aspx
Infopath开发:
1)打开工程时如果提示安装the application for the project type .ipproj则需要安装下面的插件:
对于Visual Studio 2003 + InfoPath 2003:
首先安装Office 2003 Service Pack 1:
http://www.microsoft.com/downloads/details.aspx?familyid=9C51D3A6-7CB1-4F61-837E-5F938254FC47&displaylang=en
之后安装InfoPath 2003 Toolkit for Visual Studio .NET 可使Visual Studio .NET 2003开发Infopath:
http://www.microsoft.com/downloads/details.aspx?familyid=7e9ebc57-e115-4cac-9986-a712e22879bb&displaylang=en
如果不能打开Infopath工程,请去掉manifest.xsf文件的只读属性。
2)http://www.infopathdev.com/
http://blogs.msdn.com/infopath/default.aspx
3)教程:
http://office.microsoft.com/en-us/infopath/CH011619191033.aspx
http://office.microsoft.com/en-us/training/CR061832771033.aspx
http://office.microsoft.com/en-us/infopath/CH100740821033.aspx
http://office.microsoft.com/en-us/word/CH100740901033.aspx
http://office.microsoft.com/en-us/outlook/CH100740861033.aspx
Office 2007 Partner Technical Readiness Training Presentations
http://www.microsoft.com/downloads/details.aspx?FamilyID=5cb386ff-1b77-4adc-a42f-f5ea375e4ed1&DisplayLang=en
http://channel9.msdn.com/posts/scobleizer/Eric-Richards-and-Team-First-look-at-InfoPath-12/
Submitting Forms in InfoPath 2003:
http://msdn.microsoft.com/en-us/library/aa168465.aspx
SolutionBase: Building database-integrated forms with InfoPath 2003
http://articles.techrepublic.com.com/5100-22_11-5618641.html
InfoPath and OneNote: New Office applications on the block
http://articles.techrepublic.com.com/5100-10878_11-5035197.html
4)创建级联列表框:
http://office.microsoft.com/zh-cn/infopath/HA011177132052.aspx
其次:通过Infopath的菜单 "工具 "--> "编程 "或者控件的属性,可以添加自定义代码
通过infopath菜单 "工具 "--> "选项 "--> "设计 "可以指定编程语言是C#或者VB
5)
Visual Studio Debugging: "Unable to Attach to Application" Error
If you have installed an application that uses .NET Framework 2.0, you might suddenly find that you can no longer debug your managed code InfoPath forms. This can be very frustrating, but is easily fixed with the following steps:
1.Shut down Visual Studio. 2.Open Notepad and copy the following XML into it:
|
<configuration> <startup> <requiredRuntime imageVersion="v1.1.4322" version="v1.1.4322" /> <supportedRuntime version="v1.1.4322" /> </startup> </configuration> |
3.Save the file to the same folder as the InfoPath application as
InfoPath.exe.config.
The default folder is C:\Program Files\Microsoft Office\OFFICE11.
4.Launch Visual Studio, open an InfoPath project, and run the debugger.
The file you just created directs InfoPath to run in the context of .NET Framework 1.1 instead of 2.0.
http://www.infopathdev.com/blogs/greg/archive/2005/03/29/Visual-Studio-Debugging_3A00_-_2200_Unable-to-Attach-to-Application_2200_-Error.aspx
I had the same problem too. The problem was that Excel was loading the .Net 2.0 framework which the VS 2003 debugger couldn’t handle. I solved the problem by instructing Excel to load the .Net 1.1 framework instead of the 2.0. This can be achieved by creating in the directory where the EXCEL.EXE file resides a file named EXCEL.EXE.config with the following content.
<?xml version ="1.0"?>
<configuration>
<startup>
<supportedRuntime version="v1.1.4322" />
</startup>
</configuration>
Another possible solution is to use the debugger for .Net 2.0 that comes with the .NET 2.0 SDK which can be downloaded from the Microsoft website for free. This debugger is very similar to the VS debugger except that it is not integrated to a development environment.
6)
用“XML架构定义工具(Xsd.exe)”将Infopath的schema转换为数据类,即将XML文件Mapping成代码类:
调出Visual Studio .NET 2003 Command Prompt窗口,在此窗口中可以直接使用xsd.exe。可以cd到Infopath的myschema.xsd文件所在的目录再使用xsd.exe,如E:\Dev\CMS Clients\InfoPath\Microsoft.ContractManagement\InfoPathForms\Contract>xsd.exe myschema.xsd /c
注意:转换时要关掉打开的Infopath表单。
其中,myschema.xsd是infopath自己产生的数据定义文件。如果你直接使用infopath设计一个form,你是找不到这个文件的,只能看到一个xsn文件。这个xsn实际是一组文件打包后的安装文件。你把xsn后缀改为cab后,可以用winzip打开它。这时你就会看到 myschema.xsd了。
如果在VS2005下使用此命令则先调出Visual Studio .NET 2005 Command Prompt窗口,然后在此窗口中使用下面的命令:
XSD /classes /language:C# "E:\myschema.xsd" /outputdir:"E:\XSD" /namespace:a.b.c
XML架构定义工具(Xsd.exe):
http://msdn.microsoft.com/zh-cn/x6c1kb0s(vs.80).aspx
http://msdn.microsoft.com/zh-cn/x6c1kb0s.aspx
7)访问Infopath的XML数据:
http://hi.baidu.com/gatse/blog/item/4d6396540dd4021a3b293549.html
用代码访问InfoPath表单内容
http://www.cnblogs.com/linken/archive/2008/05/08/1188430.html
7)
Infopath表单在重复表中用代码动态生成3行
// The following function handler is created by Microsoft Office InfoPath. Do not
// modify the type or number of arguments.
[InfoPathEventHandler(EventType = InfoPathEventType.OnLoad)]
public void OnLoad(DocReturnEvent e)
{
//Write your code here.
for (int i = 0; i < 2; i++)
{
IXMLDOMNode objNode = thisXDocument.DOM.selectSingleNode("/my:myFields/my:group1/my:group2");
IXMLDOMNode objInsertNode = objNode.cloneNode(true);
objInsertNode.selectSingleNode("/my:field1").text = "abc";
thisXDocument.DOM.selectSingleNode("/my:myFields/my:group1").appendChild(objInsertNode);
}
}
8)怎样得到dll的路径:
//获得当前被执行的dll的绝对路径。
string aa = System.Reflection.Assembly.GetExecutingAssembly().Location;
//获得指定dll的绝对路径。
string bb = System.Reflection.Assembly.GetAssembly(typeof (MyDllFile)).Location;
//获得dll所在的文件夹。
string cc = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
//获得dll所在的文件夹的上一级文件夹。System.IO.Path.DirectorySeparatorChar代表目录分隔符如“\”。
string dd = cc.Substring(0, cc.LastIndexOf(System.IO.Path.DirectorySeparatorChar) + 1);
9)对域用户或域组的一些操作:
//advapi32.dll是一个高级API应用程序接口服务库的一部分。现在导入它的两个函数。
[DllImport("advapi32.dll")]
public extern static bool CheckTokenMembership(IntPtr TokenHandle, IntPtr SidToCheck, out bool IsMember);
[DllImport("advapi32.dll")]
public static extern bool ConvertStringSidToSid(string StringSid, out IntPtr Sid);
public static void JudgeIsMember()
{
//The groups to which a user belongs are stored by Windows, but the actual
// group name is only cached temporarily until the space is needed for something else. As a result, Windows 'forgets' group names
// for users who tend to be disconnected from CorpNet for several weeks at a time, meaning that a security check by group name
// will fail. Windows does, however, remember the SID for allowed groups permanently. As a result, we have to store the SIDs
// here, and check membership based on the SID itself rather than the group name.
//将字符串转换成SID。SID是域用户或域组的唯一标识。
ConvertStringSidToSid("S-1-5-21-124525095-708259637-1543119021-562509", out sid);
//判断当前用户是否是sid域组的成员。IntPtr.Zero表示当前用户。
CheckTokenMembership(IntPtr.Zero, sid, out isMember);
}
//得到当前域用户的标识
System.Security.Principal.WindowsIdentity identity = System.Security.Principal.WindowsIdentity.GetCurrent();
//标识的主体,也就是标识及其附加信息。
System.Security.Principal.WindowsPrincipal principal = new System.Security.Principal.WindowsPrincipal(identity);
10)
怎样在Infopath后置代码中load普通的XML文件:
http://msdn.microsoft.com/zh-cn/library/aa948640.aspx
使用 InfoPath 2003 对象模型的表单模板项目在内部采用 Microsoft XML Core Services (MSXML) 5.0 for Microsoft Office 来处理 XML。
在托管代码中,使用由 .NET Framework 类库中的 System.Xml 命名空间所提供的 XML 支持通常更加容易。
由于性质决定,MSXML 和 System.Xml 不能交换对象,因此当需要在 InfoPath 与其他托管代码之间传递 XML 数据时,需要转换 XML 数据。
下面的方法可以将 System.Xml 对象中的 XML 数据与 InfoPath 表单代码进行交换。
可下载安装“Microsoft XML Core Services (MSXML) SDK”来查询类、属性、方法的解释。下面是MSXML 4.0 SP2 和 SDK:
http://www.microsoft.com/downloads/details.aspx?displaylang=zh-cn&FamilyID=3144b72b-b4f2-46da-b4b6-c5d7485f2b42
//Here is the code to load the xml file,
//filePath is the XML file name or path of where it is available.
//namespaces is the namespace of your file. If you do not have any namespace then pass the empty string.
private IXMLDOMDocument2 LoadXmlDocument(string filePath, string namespaces)
{
IXMLDOMDocument2 xmlDocument = (IXMLDOMDocument2)thisXDocument.CreateDOM();
xmlDocument.async = false;
xmlDocument.validateOnParse = false;
xmlDocument.load(filePath);
xmlDocument.setProperty("SelectionNamespaces", namespaces);
return xmlDocument;
}
12)
怎样给Infopath form template以Full Trust权限,如果打开表单时有System.Security.SecurityException异常。
The form template must:
1.be installed and registered
2.or digitally signed with a trusted certificate
http://support.microsoft.com/kb/832512
To work around this problem in your InfoPath form, use either of the following methods:
一.Make the form a fully-trusted URN-based form.
二.Add the URL of the server that hosts the InfoPath form to the list of trusted sites in Microsoft Internet Explorer.
三.Digitally sign a form template. (Apply for InfoPath)
一.Make the form a fully-trusted URN-based form
The following command line produces a .js file and a .bak file in the same folder as the template that you are converting。The .bak file is a copy of the original form template file before the URN-based changes. The .js file is a script file that you can use to install the URN-based form:
regform /U urn:MyForm:MyCompany /T Yes C:\MyForms\MyTrustedForm.xsn
The /U switch specifies the URN to use for the form template. The /T switch specifies that the form template is fully trusted. This sets the requireFullTrust attribute in the form definition (.xsf) file to Yes.
二.Add the URL of the server that hosts the InfoPath form to the list of trusted sites in Microsoft Internet Explorer
When you add the URL of the server that hosts the InfoPath form as a trusted site, you receive the following message when you run the code:
“An ActiveX control on this page might be unsafe to interact with other parts of this page. Do you want to allow this interaction?”
If you click Yes, the code runs.
To add a site as a trusted site, follow these steps:
1. Start Internet Explorer.
2. On the Tools menu, click Internet Options.
3. In the Internet Options dialog box, click the Security tab.
4. On the Security tab, click Trusted sites.
5. Click Sites. Add the URL of the server that hosts the InfoPath form to the Add this Web site to the zone text box.
6. For example, if the name of the server that hosts the InfoPath form is MyServer, the URL that you must add to the text box is http://myserver/. Click Add.
7. This adds the newly-entered site to the Web sites list box. Click OK two times.
8. This commits the change and then closes the dialog box.
三.Digitally sign a form template
This applies to InfoPath 2003 Service Pack 1. If you digitally sign a form template with a trusted certificate, you can set the security level for the form template to Full Trust. Full Trust means that the form can access files and settings on the user's computer or on a different domain. Additionally, you can deploy and update that form template by sending the form template and updated versions of the form template to others by using an e-mail program.
To digitally sign a form with a trusted certificate, follow these steps:
1. In Design mode, click Form Options on the Tools menu.
2. In the Form Options dialog box, click the Security tab in InfoPath 2003 or click to select the Security and Trust check box in InfoPath 2007.
3. Under Form Signing in InfoPath 2003, click to select the Sign this form check box.
Under Form Template Signature in InfoPath 2007, click to select the Sign this form template check box.
4. Click Select Certificate.
5. In the Select Certificate dialog box, click the certificate that you want to digitally sign the form with.
Note If a certificate is not trusted on a user's computer, Microsoft Office InfoPath 2003 displays a security message and requires the user to enable trust for the certificate issuer before the user can open the form.
InfoPath 2003 Software Development Kit (SDK)
http://www.microsoft.com/downloads/details.aspx?FamilyID=351f0616-93aa-4fe8-9238-d702f1bfbab4&displaylang=en
我们发布一个Infopath表单模板到Sharepoint表单库是非常简单的事情,但是当我们Infopath中包含自定义的代码的时候,就会发现发布到Sharepoint表单库后,表单中的自定义代码无法运行,通常会报一个没有权限的错误。
首先要得到infopath的urn,从文件->提取表单,就可以提取到表单的所有文件,或者将xsn改成cab,用rar解压缩也可以。得到的文件中有一个manifest.xsf,用记事本打开后从里面我们可以看到<xsf:xDocumentClass>该元素中的name属性便是这里我们用的urn名字,我这里得到的是“urn:schemas-microsoft-com:office:infopath:infopath:-myXSD-2005-11-05T12-31-24”。
运行testsave.js文件,直到显示注册成功。
这个时候,表单在本地就可以运行自定义代码了,但是当你发布到Sharepoint的时候,仍然会不可用,为了能够在Sharepoint中使用,我们需要对表单模板进行签名。从工具->表单选项->安全中进行签名,可以利用infopath直接创建一个证书,也可以使用CA颁发的证书。
然后就可以发布到Sharepoint表单库中了。当发布完毕后,如果你在制作Infopath的机器上直接填写表单,不会有任何问题。但是如果是其它机器从Sharepoint中填写表单,则会提示对话框。这是因为没有信任证书的原因,点击详细信息按钮,然后选择安装证书,直到安装证书成功。然后关闭infopath,再重新填写表单,就会发现复选框已经可以选择,选中复选框,然后选择打开。
另外再告诉大家一个价值5小时的经验,那就是在制作模板的时候不要把模板放在有中文名称的目录里面,否则运行regform的时候将会出错,报一个“System error”的错误。这个错误损耗掉了我至少5小时的时间。
regform.exe在E:\Program Files\Microsoft Office 2003 Developer Resources\Microsoft Office InfoPath 2003 SDK\Tools下面,它的使用实例如下:
C:\Documents and Settings\jason_li>"E:\Program Files\Microsoft Office 2003 Developer Resources\Microsoft Office InfoPath 2003 SDK\Tools\regform.exe" /U urn:schemas-microsoft-com:office:infopath:Contract-xsn:-myXSD-2004-12-15T23-15-19 /T Yes
"C:\Documents and Settings\jason_li\Desktop\InfoPath\InfoPath\Microsoft.ContractManagement\InfoPathForms\Contract\bin\Debug\Contract.xsn"
如果想再生成个新的Contract.js,则需要将下面的两个同时删除:
Contract.bak
Contract.js
删除前一定要用Contract.js反安装当前的Contract.xsn文件否则只能通过删除注册表来实现反安装。删除下面的键值:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\11.0\InfoPath\SolutionsCatalog\urn:schemas-microsoft-com:office:infopath:Contract-xsn:-myXSD-2004-12-15T23-15-19
用Contract.js反安装Contract.xsn的写法如下:
C:\Documents and Settings\jason_li>"C:\Documents and Settings\jason_li\Desktop\InfoPath\InfoPath\Microsoft.ContractManagement\InfoPathForms\Contract\bin\Debug\Contract.js" "C:\Documents and Settings\jason_li\Desktop\InfoPath\InfoPath\Microsoft.ContractManagement\InfoPathForms\Contract\bin\Debug\Contract.xsn" /uninstall
13)
How debug Fully Trusted InfoPath Forms with Managed Code Business Logic:
为什么Debug时要求full trust?
When debugging, Focus will move to the line of code in the code editor that is calling the member that requires full trust,
and the following message will be displayed: "SecurityException was unhandled by user code - Request failed".
To allow the form template's business logic to call this member when it is being debugged or previewed, you must set your
form template's security level to Full Trust as described in the following procedure.
可以由vs直接调试
也可以在后置代码中加System.Diagnostics.Debugger.Break();来引起一个调试
为什么不能用regform.exe安装注册.xsn文件的办法实现Fully Trusted调试?
regform.exe会进行下面的操作(参见http://msdn.microsoft.com/en-us/library/aa662309(office.11).aspx的Manually Creating a Fully Trusted Form):
1.Add the following attributes to the xDocumentClass element in the manifest.xsf file:
requireFullTrust="yes"
name="urn:MyForm:MyCompany"
修改publishUrl=""
2.打开Template.xml文件,Remove the href attribute from the mso-infoPathSolution,加name attribute其值与.xsf file中相同。
3.Repackage the files into the .xsn CAB format with a tool such as makecab.exe.
4.Create a custom installation program by using the RegisterSolution method to install the fully trusted form.
If you need to remove a fully trusted form, you can use the UnregisterSolution method of the ExternalApplication object.
当按F5调试时,会将manifest.xsf和Template.xml文件重置并repackage。这就需reinsall这个Form Template。可以按照上面先修改manifest.xsf和Template.xml文件,再debug就能重置为修改时候的了,但是publishUrl=""不能保持为空,当编译后还是有路径,所以不能用regform.exe安装。
通过注册manifest.xsf文件(被注册到注册表的HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\11.0\InfoPath\SolutionsCatalog位置)实现Full Trust的debug:
http://msdn.microsoft.com/en-us/library/bb735653.aspx
http://msdn.microsoft.com/en-us/library/ms788214.aspx
第一种写法:
To create a JavaScript file that grants FullTrust permissions to form template
1.
In InfoPath Designer, on the Tools menu, and then click Form Options.
2.
Click Security.
3.
Clear the Automatically determine security level based on form's design (recommended) box.
Note: |
|
InfoPath cannot automatically detect business logic that requires full trust permissions so we must explicitly give full trust permissions. |
4.
Select Full Trust, and then click OK.
5.
Close InfoPath Designer. Click Yes if asked to save changes.
6.
In Visual Studio, in Solution Explorer, double-click the manifest.xsf file to open it.
7.
In the root node, look for the publishUrl attribute and remove it along with its value.
8.
Save your changes.
9.
In Visual Studio .NET 2003, on the Build menu, click Build Solution.
10.
Open Notepad (or any other text editor).
11.
Add the following code to a blank text file.
oApp = WScript.CreateObject("InfoPath.ExternalApplication");
strAbsolutePath = "project_folder_url\\manifest.xsf"
oApp.RegisterSolution(strAbsolutePath,"overwrite");
Note: |
|
Do not forget to escape your path to your manifest.xsf. All \ in your path should be replaced with \\. |
12.
Save this file on your computer as register.js
13.
Double-click the register.js file that you just created.
第二种写法:
1. make the form Fully Trusted
2. Open the manifest.xsf and remove the publishURL
3.写下面的代码:
'Sample courtesy of Jeff Webb
'http://www.mcse.ms/archive180-2004-4-605806.html
set ip = CreateObject("InfoPath.Application")
'获得此脚本所在的文件夹
Set fso = CreateObject("Scripting.FileSystemObject")
pth = fso.GetFolder(".").path
ip.registersolution pth & "\manifest.xsf"
set ip = nothing
set fso = nothing
MsgBox ("The InfoPath form template has been registered.")
4.因为是VBScript文件所以保存为.vbs文件。
The ExternalApplication object is a deprecated type that should no longer be used for automation. The Application object and the XDocument object contain the properties and methods needed for external automation of the InfoPath application.
For backward compatibility, the ExternalApplication object can be used to perform a limited set of InfoPath operations such as creating, opening, or closing a form; registering or un-registering a form template; or simply quitting the application.
14)Infopath脱机功能开发:
InfoPath 2003用代码检测表单的连接状态:
http://office.microsoft.com/en-us/infopath/HA011227901033.aspx
InfoPath 2007用代码检测表单的连接状态:
http://office.microsoft.com/zh-cn/infopath/HA101575532052.aspx?pid=CH100341122052
InfoPath 2007添加按钮以刷新数据连接:
http://office.microsoft.com/zh-cn/infopath/HA102117392052.aspx?pid=CH100341122052
InfoPath 2003当提交表单而脱机时生成一个Mail并将Form作为EMail附件保存并等待提交:
http://msdn.microsoft.com/zh-cn/aa944801.aspx
InfoPath 2003当提交表单而脱机时保存表单为xml并排队提交:
http://blogs.msdn.com/infopath/archive/2004/03/17/91313.aspx
15)用script解包.xsn文件,修改manifest.xsf文件,再打包成.xsn文件:
http://blogs.msdn.com/infopath/archive/2004/05/04/126147.aspx
http://blogs.msdn.com/infopath/archive/2004/05/05/126723.aspx
http://blogs.msdn.com/infopath/archive/2004/05/06/127594.aspx
http://blogs.msdn.com/infopath/archive/2004/05/07/127958.aspx
http://blogs.msdn.com/infopath/archive/2004/05/07/128224.aspx
中文的
http://blog.csdn.net/yanwei100/archive/2006/12/20/1450535.aspx
16)
VS2005+Infopath2007开发:
VS2005需要装Microsoft Visual Studio 2005 Tools for the 2007 Microsoft Office System 也称为“Visual Studio 2005 Tools for Office Second Edition”或“VSTO 2005 SE”,就可以有开发Infopath2007的模版了。
在安装次插件之前要先安装InfoPath2007,否则在VS2005里看不到开发Infopath2007的模版,如果先装了插件也要卸载再装完InfoPath2007之后再装此插件,通过更新安装也不能看到模版。
1.确保您只安装了 Microsoft Office 的一个版本。VSTO 2005 SE 不支持并行安装了 Microsoft Office 产品的两个不同版本的配置,已确知 VSTO 2005 SE 在这种配置下无法正常工作。
2.Microsoft Office InfoPath 2003 Tools for Visual Studio 2005 用户:如果您计划将 VSTO 2005 SE 与 InfoPath 2007 一起使用,那么应当在安装 VSTO 2005 SE 之前卸载 InfoPath 2003 Tools for Visual Studio 2005。
不需要安装Visual Studio 2005 Tools for Office Update: InfoPath 2007 Beta Support
http://www.microsoft.com/downloads/details.aspx?familyid=00779894-e95f-4b22-8590-07584c891207&displaylang=en
这个应该是开发Beta版的Infopath的插件,如果装了此插件而开发正式版的Infopath则可能会抛出“attempted to read or write protected memory this is often an indication that memory is corrupt”错误。
17)在vs2005或vs2008下开发Infopath2007,debug的时候如果抛出错误“Infopath cannot open the selected form.” 需要检查两个地方:
1.将Security设置成Full Trust才能解决。
2.如果你的源代码移动过位置,可能遇到上面的错误,具体解决办法如下:
http://groups.google.com/group/microsoft.public.infopath/browse_thread/thread/29bd1699a4184aa2/d7fb43b622f35e4d?lnk=raot
This error may occur after you launch an XSN file with the same form ID as
the form template in your Visual Studio project. The XSN file is cached on
your hard disk, but with default XML that doesn't conform to your current
schema.
第一种解决办法:
Workaround - close down VS2005 and double-click manifest.xsf in the InfoPath
Form Template subfolder within your project folder. Answer YES to the big
warning box that pops up. Then close down InfoPath and reopen your project in
Visual Studio. You should now be able to run the form in Preview mode from
VS2005.
第二种解决办法:
Try using the following command to clear the form template cache:
在命令行输入下面的命令.
"C:\Program Files\Microsoft Office\Office12\InfoPath.exe" /cache ClearAll
或者or delete directly files on your harddrive.
另一种解释:
There are a wide variety of things that can cause this error as this is the most generic of errors for InfoPath:
1. Open up the form in the Rich Client/InfoPath 2007. This give the options to click "Details" and get a more specific error. Opening in Visual Studio or in the web client does not provide this option so it is a guessing game as to why.
2. Building the solution in VS2005 isn't enough and won't create an XSN, need to publish instead of build. Once the XSN is created, open in the rich client and see if the error occurs and get details. Check the date on the XSN to verify it built the file.
3. I'm using Full Trust Security mode which is not set by default. Open up the manifest.xsf in VS2005, select Tools... Form Options.. Security.
4. This one is tricky... The cache won't refresh in VS2005. Close VS2005 then click on the manifest.xsf file. During the open process it will ask if you want to overwrite the cached version. Say yes.
5. Beyond this it is typically a schema issue with the xml.
6. Can also try restarting VS2005 and/or removing then readding references in the VS2005 solution.
Also, to use the Tools.. Form Options... Preview feature:
1. Open up the XSN in InfoPath and fill out the form.
2. Save As.. and enter the file name. Usually I put sampledata.xml and place in the project directory.
3. Goto Tools... Form Options... Preview... and enter this file name.
4. Now when the form is run, it shows the data that was entered in step 1.
18)开发Infopath2003时最好别同时装Infopath2007否则debug预览时会报错误“Infopath cannot create a new, blank form. The form template is not valid. InfoPath cannot open the selected form because of an error in the form's code.”
Solution:
Make sure, when you install Office 2007 and you need to keep Infopath2003 for dev purposes, do a "Customize" install of Office 2007. Select the box where you can keep previous versions of Office and
continue to install Office 2007. Your end result will be a side by side installation of Office 2007 and your previous version of Office.
19)可以使用 Wsdl.exe 工具创建代理类。 随后,Web 服务客户端便可以调用该代理类的方法,这些方法通过处理发往和来自 Web 服务的 SOAP 消息来通过网络与该 Web 服务进行通信。 由于代理类通过 Internet 与 Web 服务通信,因此最好验证该代理类的 Url 属性是否引用受信任的目标。
wsdl http://10.192.12.125:8086/getdata.asmx /out:proxy.cs
http://msdn.microsoft.com/zh-cn/library/7h3ystb6.aspx
http://msdn.microsoft.com/zh-cn/library/cy2a3ybs(VS.80).aspx
http://msdn.microsoft.com/zh-cn/library/d2s8y7bs.aspx
20)The type 'CMSWebServices.Global' is ambiguous: it could come from assembly 'C:\SYSROOT\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\cmswebservices\9f47ba1e\3650df8c\App_Code.enoeb--o.DLL' or from assembly 'E:\download\CMSWebServices\bin\CMSWebServices.DLL'. Please specify the assembly explicitly in the type name.
问题的原因是bin目录里有重复的dll,因为一个站点应用程序build后vs2003生成dll在bin里,vs2005生成在临时文件里,vs2005在发布后才生成dll在bin里。
Outlook:
1)为什么需要备份邮件:
控制面板-Mail-Show Profiles中的每个profile可以设置多个邮箱(即Account),但只能连到一个Exchange Server,其他的都是普通邮箱,Exchange Server的脱机文件为.ost后缀,存档文件为.pst后缀,普通邮箱的都是.pst后缀。
.ost文件不能通过连接到其他Exchange Server而打开,必须还要连到其当初的Exchange Server,所以要有当初的帐号和访问权限。所以要想得到此邮件,可以存档,存档后为.pst文件,可以被Outlook打开。也可以用软件将.ost文件转换成.pst文件,软件有:Advanced Exchange Recovery和OST2PST。
关于怎样更改以建好的帐户的保存脱机文件的位置,请参见:
http://office.microsoft.com/zh-cn/outlook/HA012276282052.aspx
也可新建帐户时直接更改此位置。
(2) 释放Office的COM对象
http://blogs.geekdojo.net/richardhsu/archive/2003/11/14/281.aspx
http://social.msdn.microsoft.com/forums/en-US/vsto/thread/b0ac73a4-7a54-4d10-a1dd-54404ff1678e/
Exception from HRESULT: 0x80010001 (RPC_E_CALL_REJECTED)
http://www.cnblogs.com/zhaoxinxin/articles/1618020.html
Operation aborted (Exception from HRESULT: 0x80004004 (E_ABORT))
http://social.msdn.microsoft.com/Forums/zh-CN/vbgeneral/thread/84ae387f-5dd8-421d-b25f-206e5da968f3
Outlook "Object Model Guard" Security Issues for Developers
http://www.outlookcode.com/article.aspx?id=52
Administrative Options for the Outlook E-mail Security Update
http://www.slipstick.com/outlook/esecup/admin.htm
Code Security Changes in Outlook 2007
http://msdn.microsoft.com/en-us/library/bb226709.aspx
Reading an Outlook MSG File in C#
http://www.codeproject.com/KB/office/reading_an_outlook_msg.aspx
Bridging the gap between .NET and Extended MAPI
http://www.codeproject.com/KB/office/BridgingTheGap.aspx
调试:
http://msdn.microsoft.com/zh-cn/library/d0b8xh0y(VS.80).aspx
(1)
调试项目时如果遇到下面的错误:
Could not write lines to file "obj\Components.csproj.FileListAbsolute.txt". Access to the path 'E:\InfoPath2007\Microsoft.ContractManagement\Components\obj\Components.csproj.FileListAbsolute.txt' is denied.
解释:
FileListAbsolute表示“文件绝对路径列表”,包括.dll、.exe以及.pdb文件等。
If you look in this file you should find the string of Illegal characters that match the error. Anyway, make a copy of this file as a backup (just in case). Then delete the original version and rebuild your project. This file apparently gets recreated if it does not exist and will correct itself, at least it did for me. You should get a clean build now.
(2)怎样对一条特定的线程进行调试:
Visual C++调试器支持多线的情况,如果你在许多线程都调用的函数中设置一个断点,每当一个线程遭遇到此断点,调试器就会在线程之间循环切换有个方法可以避开这个问题,就是挂起所有线程,除了你感兴趣的那条(要调试的那条),在调试器中打开[Debug]菜单并选择[Thread]你就可以获得一个线程对话框,在这里你可以挂起所有的线程,把你要调试的线程留下来,单独调试。
(3)多进程调试方法:
方法一:
1.在vs中选择Debug-选择Attache to Process-选择主进程。
2.通过Debug-Windows-Processes打开Processes窗口,点击Attache to Process-点击Refesh直到第二个进程出现-选择此进程。第二个进程有时候不会马上在Attache to Process窗口看到,或者是灰显的,要不断点击Refesh才能出现。
http://msdn.microsoft.com/zh-cn/library/c6wf8e4z(VS.80).aspx
方法二:
在你想要调试的子程序的代码中加入一句代码DebugBreak();
DebugBreak Reference in C#, VB.NET and VB6
Library:kernel32.dll
Visual Basic .NET definition
Declare Sub DebugBreak Lib "kernel32" ()
C# definition
[DllImport("kernel32.dll", SetLastError=true)] static extern void DebugBreak ()
Description
DebugBreak Causes a breakpoint exception to occur in the current process.
Dotnet Replacement :
VB.Net:
System.Diagnostics.Debugger.Break()
C#:
System.Diagnostics.Debugger.Break();
然后重新编译你的子程序的调试版本。现在调试主程序,子程序的调试版本在运行的过程中,当执行到DebugBreak()时,将会抛出一个异常,这个异常会由操作系统捕捉到,然后弹出一个对话框,说程序遇到了问题,问你要不要发送错误报告,点击该对话框的调试按钮,系统又会弹出一个对话框,选择相应的调试器进行调试,然后子进程就会中断在代码DebugBreak()处,接下来就可以正常调试了。任何进程都可以添加一个DebugBreak函数强制中断,相当于设置断点,这个用于调试服务、DLL等尤其方便。
如果你想使用的vs没有出现在弹出的对话框里,请按照下面的步骤设置:
To enable/disable Just-In-Time debugging
1. On the Tools menu, click Options.
2. In the Options dialog box, select the Debugging folder.
3. In the Debugging folder, select the Just-In-Time page.
4. In the Enable Just-In-Time debugging of these types of code box, select or clear the relevant program types: Managed, Native, or Script.
To disable Just-In-Time debugging, once it has been enabled, you must be running with Administrator privileges. Enabling Just-In-Time debugging sets a registry key, and Administrator privileges are required to change that key.
5. Click OK.
(4)JavaScript调试:
1)用VS2005调试Javascript时最好用Ctrl+F5(不调试直接运行)不要用F5(调试后运行),因为后者的调试器还是用同一个VS2005且单步光标指示的位置也不是实际位置,而前者可以选择是否打开新的VS2005调试Javascript且光标停的位置也是正确的。
光标不停在实际位置的另一个解决办法是,将web站点部署到IIS,通过IIS浏览这个站点,当出现javascript错误时候会提示你打开vs调试,此时会停在实际位置。
两种方法都不要选择当前的vs作为调试器,否则停的位置不正确。
以上的原因可能是页面继承了MasterPage,而Javascript代码又在Master Page里,使得vs找不到实际的代码。
(5)使用Visual Studio的RPC调试功能同时调试COM程序的客户端和服务端
http://blog.csdn.net/Donjuan/archive/2009/01/23/3851586.aspx
(6)怎样设置“当表达式值发生改变时中断”的断点
http://blogs.msdn.com/habibh/archive/2009/06/12/visual-studio-debugger-break-when-expression-has-changed.aspx
(7)调试SSL(HTTPS)站点的方法:
1.先用IE打开SSL站点然后,attach到这个IE进程。
2.用VS打开站点源码时,选择Local IIS。勾选Use Secure Sockets Layer。打开后check一下VS中的Solution Explore中的project名是否是SSL端口而不是TCP端口。此种方法debug时候会报“unable to start debugging on the web server. the underlying connection was closed”。
可以用下面的方法替代:
右键站点选属性,去到Directory Security,点Edit,不勾选“Require secure channel”。此时在IE中既可以用https+SSL端口,也可以用http+TCP端口访问此站点。所以此时用VS打开站点源码时,选择Local IIS。不勾选Use Secure Sockets Layer。打开后check一下VS中的Solution Explore中的project名是否是TCP端口而不是SSL端口。此时就可以Debug了。
3.用VS打开站点源码时,选择Local IIS。然后右键工程选Property Pages,选Start Options,在Start Action中选Start URL单选钮并设置值为https://asmbtvm25.redmond.corp.microsoft.com。然后调试。此种方法debug时候会报“unable to start debugging on the web server. the underlying connection was closed”。
4.用VS打开站点源码时,选择Remote Site。如果你没装FrontPage Server Extensions 2002则会碰到下面的问题:the web server does not appear to have the frontpage server extensions installed。
需要安装FrontPage Server Extensions 2002,然后iisreset。
下面是FrontPage Server Extensions 2002的一些介绍:
FrontPage Server Extensions 2002 能够为您快速的管理您的远程INTERNET信息服务,以及您的网站。您可以不在服务器前就可以远程管理您的网站。
网站扩展后,FrontPage 客户端可打开该站点,并在 FrontPage 中对站点进行编辑创作。未扩展的站点无法在 FrontPage 中打开或编辑。
使用 FrontPage 2002 服务器管理工具扩展站点
在“开始”菜单中,指向“所有程序”、指向“管理工具”,然后单击“Microsoft SharePoint 管理器”。
单击“提交”。“FrontPage 2002 服务器管理”工具将 FrontPage Server Extensions 模板目录以及其他包含元数据的文件添加到您的虚拟服务器的内容目录下。
To manually configure FrontPage Server Extension on Windows Server 2003
1.On the Start menu, choose Control Panel and then select Administrative Tools.
2.Select Computer Management.
3.In the Computer Management dialog box, expand the Services and Applications node, and then expand the Internet Information Services (IIS) node.
4.Select Web Service Extensions.
5.In the list on the right, select FrontPage Server Extensions <version number> and then click Allow.
6.In the Computer Management dialog box, expand the Web sites node.
7.Right-click Default Web Site, choose All Tasks, and then choose Configure Server Extensions <version number>.
Note If the Configure Server Extensions menu command does not appear, FrontPage Server Extensions are already installed and configured.
8.Click Submit on the Extend virtual server with FrontPage Server Extensions 2002 page.
(8)
VS2005中远程调试:
1.附加到远程机器上的进程:
在VS2005中不能使用VS2003的远程调试程序。VS2005远程调试的方法:
(1) 远程端:安装VS2005光盘"X:\vs\Remote Debugger\x86\ rdbgsetup.exe"。或者直接运行或copy本地端的: "Program Files\Microsoft Visual Studio 8\Common7\IDE\Remote Debugger\x86"
(2) 远程端:“本地安全策略 - 安全选项 - 网络访问:本地帐户的共享和安全模式”改为:经典-本地用户以自己的身份验证。
(3) 远程端:启动Remote Debuger,从“工具 - 选项”中将身份验证模式改为“无身份验证,允许任何用户进行调试”。
或者直接用命令行:"X:\ msvsmon.exe" /noauth /anyuser /nosecuritywarn,可以建个快捷方式以方便运行。
(4) 本地:在VS2005中,“工具”--“附加到进程”,传输选“远程”,限定符输入远程端的主机名或IP地址,回车,终于出来了可爱的进程列表。
http://blog.csdn.net/ydbcsdn/archive/2009/03/19/4003306.aspx
2."附加到进程"只能在远程端程序运行以后进行,如果远程端在启动时的初始化存在问题,这个方法就没法调试初始化部分的代码了。 有没有像vc6里面指定远程端程序,然后可以直接从本地启动远程程序并调试的方法?
VC6我没用过,不知道它是怎么样的。我用VS2005编译结果都是直接输出到调试机(另一台机器),应该和你说的是一种情况吧?直接在编译的机器按F5就可以把调试机上的程序RUN起来。
方法:
1、先在你的调试机上建立一个可读写的共享目录。
2、把你编译机器的输出目录设到这一目录。
3、设置调试选项,调试选项中填写的目录都是调试机上的目录。
我想运行msvsmon.exe这个东东你应该都知道的吧。Good lucky!
(9)
VS2010远程调试WebSite(只能attach上去,没找到怎样debug代码):
http://winsystem.ctocio.com.cn/283/11785283.shtml
远程被调试端
如果attach到iexplore.exe进程则需要32位的Remote Debugger Monitor,所以拷贝Remote Debugger的x86版本到远程机器
运行msvsmon作为Run as administrator
本地调试端
选Debug-选Attach to Process-Transport: Default-Qualifier: CO1ESVCMSIISU02.redmond.corp.microsoft.com
(10)
Debug Windows Service 工程
http://www.cnblogs.com/HomeGIS/archive/2009/06/20/1507186.html
http://tech.sina.com.cn/s/2007-08-17/17221683879.shtml
http://support.microsoft.com/kb/824344
http://msdn.microsoft.com/zh-cn/library/7a50syb3(VS.80).aspx
(11)
Changing the default Visual Studio browser
Changing the default browser used in VS 2005 and Visual Web Developer
http://weblogs.asp.net/scottgu/archive/2005/11/18/430943.aspx
Visual Studio opens the default browser instead of Internet Explorer
http://stackoverflow.com/questions/79954/visual-studio-opens-the-default-browser-instead-of-internet-explorer
How to change the default browser in Visual Studio programmatically with PowerShell and possibly poke yourself in the eye
http://www.hanselman.com/blog/HowToChangeTheDefaultBrowserInVisualStudioProgrammaticallyWithPowerShellAndPossiblyPokeYourselfInTheEye.aspx
我的总结:
1.
1) Right click on a .aspx page in your solution explorer
2) Select the "browse with" context menu option
3) In the dialog you can select or add a browser. If you want Firefox in the list, click "add" and point to the firefox.exe filename
4) Click the "Set as Default" button to make this the default browser when you run any page on the site.
2.
Note that there is also an optional drop-down at the bottom of the dialog that lets you select the default browser window size when loading. You can choose 800x600 or 1024x768
3.
There is now a Default browser selector Extension for 2010 to help combat this
12)
Disabling script debugging in VS 2008 + IE8
http://blogs.msdn.com/b/greggm/archive/2009/04/06/disabling-script-debugging-in-vs-2008-ie8.aspx
我的总结:
vs2008不用设置IE也能debuge JavaScript,此时会出现'Script Documents'在'solution explorer'下。这会影响性能,如果你不想debuge的时候。可以通过3.Go to the 'Start Options' sheet, and click the 'Silverlight' button.禁用自动debuge。Because the debugger cannot debug both Silverlight code and Script code at the same time, this will disable Script debugging and therefore avoid the problem.
13)
在IE8下Visual Studio 2005不能调试Web应用程序
Script debugging broken in VS 2005 after installing IE8
http://blogs.msdn.com/b/greggm/archive/2009/04/01/script-debugging-broken-in-vs-2005-after-installing-ie8.aspx
Visual Studio 2005 Script debugging is broken after installing IE8 on Windows Vista
http://support.microsoft.com/kb/2000608
系统更新到IE8后,Visual Studio 2005不能调试Web应用程序
http://www.chinaitlab.org/space-77-do-blog-id-3412.html
我的总结
1) Open RegEdit
2) Browse to HKEY_LOCALMACHINE -> SOFTWARE -> Microsoft -> Internet Explorer -> Main
3) Add a dword under this key called TabProcGrowth
4) Set TabProcGrowth to 0
If you are using Vista you need to turn off IE "Protected Mode" which is a checkbox on the Security Tab under Tools -> Internet Options.
Changing the default Visual Studio browser to Firefox
调试的时候不开启任何IE8的进程。
you could just use only one window at a time. I have IE8 and VS 2005. All I had to do was enable debugging in the options and make sure all other IE windows were closed before debugging.
14)
详解Visual Studio调试中断点几个的小技巧
http://kb.cnblogs.com/page/49829/
安装包:
1)在VS2005生成的安装包中,.msi文件和.exe文件的区别:
先为你解释一下MSI的意思,说到MSI文件,不得不先说说Windows Installer,它不只是安装程序,而是可扩展的软件管理系统。Windows Installer的用途包括:管理软件的安装、管理软件组件的添加和删除、监视文件的复原以及使用回滚技术维护基本的灾难恢复。另外,Windows Installer还支持从多个源位置安装和运行软件,而且可以由想要安装自定义程序的开发人员自定义。要想使用这些功能,就必须通过MSI文件。MSI文件是Windows Installer的数据包,它实际上是一个数据库,包含安装一种产品所需要的信息和在很多安装情形下安装(和卸载)程序所需的指令和数据。MSI文件将程序的组成文件与功能关联起来。此外,它还包含有关安装过程本身的信息:如安装序列、目标文件夹路径、系统依赖项、安装选项和控制安装过程的属性。
如果你是用.net 打包工具进行的打包,并且写了一个自定义类去读取某些值,举个例子,比如你要得到安装程序的运行路径,你会发现,起始位置会是C:\Windows\system32。但是如果你是自己写的一个.EXE文件,它的取得的位置会是实际位置。
对于注册表的读取,应该没有什么影响,但我要提醒你,会不会有别的什么地方处置的不妥当。
.msi需要Microsoft的一个服务支持(大概叫做Microsoft Installer,目前版本2.00),基本上只用于安装软件。
.exe是可执行文件,不一定是安装程序。
msi是微软出的一种封装格式,只适用于windows系统,对安装和卸载都有严格要求,支持系统还原,微软出的软件都用这种格式安装
.msi是微软的自解压文件,如安装某些软件时就是这种文件格式打包而成的,Windows系统中自带有软件将其解压。正如WINRAR可以将文件压缩成.rar文件,也可以将.rar文件解压一样;而.exe是可执行文件类型,通俗一点来说.exe文件不依靠其他软件(当然不能脱离系统)而单独运行的文件,因为.exe就是软件。
2)
.net打包自动安装数据库
http://www.chinaz.com/program/2007/0413/6872.shtml
DotNet系统安装程序制作StepByStep(包括FrameWork安装和数据库安装配置)
http://hi.baidu.com/ybear2008/blog/item/5bdd4ef8f540b708d9f9fdcb.html
如何用VS2005制作Web安装程序
http://www.diybl.com/course/1_web/webjs/2008224/101626.html
系统:
1)怎样解决Windows XP的IE错误"Internet Explorer has encountered a problem and needs to close. We are sorry for the inconvenience."
症状:
当打开某个特殊的网址时,而不是所有的网站,IE会出现"Internet Explorer has encountered a problem and needs to close. We are sorry for the inconvenience."的对话框,点击对话框中的"click here"链接时弹出的对话框包含"Error signature AppName: iexplore.exe AppVer: 6.0.2900.2180 ModName: pnxr3260.dll ModVer: 6.0.7.4552 Offset: 00003e98"信息,当点击第一个对话框中的"Don't Send"按钮时,网页会自动关闭。
解决方法:
在系统盘上查找pnxr3260.dll,通常在C:\Program Files\Common Files\Real\Plugins\pnxr3260.dll,删掉它。这是RealOne Player的一个文件,会导致很多莫名其妙的错误,建议卸载RealOne Player,使用RealPlayer10,或者升级RealOne Player。
如果上面的方法不行(应该行,因为我的就这样解决了),就到华军软件园下载"黄山IE修复专家"软件,启动到网络连接的安全模式,用此软件修复IE,但这种方法是解决中病毒的情况。
2)svchost.exe占用CPU 100%的解决方法
现象:
机器启动运行几分钟后 svchost.exe就会占系统cpu资源的100%
拔掉网线重启就好了,重连上网后一会儿:svchost.exe又占cpu资源的99%;
在断掉网线系统能正常工作的情况下,打开控制面板-管理工具-服务,找到"Automatic Updates",设置成stop,再插上网线,CPU占用率高的问题消失。
确认:
A)
按ctrl+alt+del打开任务管理器,点击“View-Select Columns”,钩选PID(进程标识符)。然后在进程选项卡查看进程信息。XP系统可能有多个名称为svchost.exe的进程。如果发现某一个svchost.exe进程CPU占用率高,记下这个进程的PID。
B)
1.在run里运行cmd,在命令窗口中退到cd C:\后运行Tasklist /m wuaueng.dll命令。
找到运行Automatic Update服务的SVCHOST进程的PID看是否与占用CPU过高的PID相同。如果相同,可以判断是此问题。
2.此步骤帮助用户判断问题。执行下面的命令行来强制客户端发起补丁检测 (某些情况下这个命令行能够重现CPU占用率过高的问题)
Wuauclt /detectnow
解决方案:
您可以尝试用下面的方法看能否解决这个问题:
1.安装更新KB927891:
http://support.microsoft.com/kb/927891
2.如果安装了更新KB927891之后,客户端仍然有持续的100%CPU问题,请您下载安装最新的WSUS 3.0 客户端:
http://download.windowsupdate.com/v7/windowsupdate/redist/standalone/WindowsUpdateAgent30-x86.exe
针对64位操作系统:
http://download.windowsupdate.com/v7/windowsupdate/redist/standalone/WindowsUpdateAgent30-x64.exe
http://download.windowsupdate.com/v7/windowsupdate/redist/standalone/WindowsUpdateAgent30-ia64.exe
上面两个步骤应该能够缓解这个问题。关于这个问题的最新的进展请参考:
http://blogs.technet.com/wsus/archive/2007/04/28/update-on.aspx
3)Using XP and intalled IE7. Every time i start internet it will not start with
my preset webpage but it starts with
http://go.microsoft.com/fwlink/?LinkId=74005 and then jumps to
http://www.msn.com/404.aspx?aspxerrorpath=/runonce2.aspx.
Can someone help me with this problem ?
解决办法:
http://support.microsoft.com/kb/945385/en-us
1. Click Start, click Run, type regedit, and then click OK.
2. Locate the following registry subkey, and then click it:
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main
3. In the details pane, double-click the RunOnceHasShown registry entry.
Note If the RunOnceHasShown registry entry is not located in the details pane, you must create it. To do this, point to New on the Edit menu, click DWORD Value, and then type RunOnceHasShown in the New Value box.
4. In the Value data box, type 1, and then click OK.
5. In the details pane, double-click the RunOnceComplete registry entry.
Note If the RunOnceComplete registry entry is not located in the details pane, you must create it. To do this, point to New on the Edit menu, click DWORD Value, and then type RunOnceComplete in the New Value box.
6. In the Value data box, type 1, and then click OK.
7. Close Registry Editor.
4)x86,x64和IA64的区别:
X86是一个指令集。
X64就是基于x86架构的64位CPU。AMD64位CPU就是用这种技术的,全称应该是X86-64。
IA64指安腾(Itanium)体系的架构的64位CPU。IA64是INTEL的技术。
5)
GDR Software Updates和QFE Software Updates区别:
基本上来说,现在微软Windows补丁包中的更新文件大致包含了两类。一类叫做GDR(普通分发版本),一类叫做QFE(快速修补工程更新)。其中,GDR文件经过了大量严格的测试,稳定性很高。而对QFE所做的测试相对则要相对少一些,所以稳定性亦要低一些。
所以,微软的补丁包也可以按此分为两类。一类就是安全修补程序,这类补丁包中同时包含了GDR和QFE版本的更新文件,也就是两个副本。微软的很多关键性安全补丁就属于此类。还有一类叫做修复程序,仅包含了QFE版的更新文件。常见的就是一些需要正版验证的补丁。
那么为什么安全修补程序要包含两种版本的文件呢?如果你要在系统中安装修复程序,也就是说要安装QFE更新文件。然而当前系统中需要被替换的文件为GDR版,而且版本号要比补丁包中的QFE文件版本号高,那么就不能用补丁包中的QFE文件来替换,而需要用与当前GDR文件版本相同的QFE文件来修补。那么到哪里取得这个文件呢?其实这个QFE文件在你以前安装GDR版更新文件(就是当前系统中使用的文件)时就已经被同时复制到了你的硬盘中。这就是安全修补程序需要同时包含GDR和QFE更新文件,且两类文件版本号都相同的原因。
以名为WindowsXP-KB896688-x86-CHS.exe的安全修补程序为例来说明,该补丁包需要更新MSHTML.DLL这个文件。如果安装程序检测到系统中当前的MSHTML.DLL为GDR版时,则会用补丁包中GDR版的MSHTML.DLL(文件说明为xpsp_sp2_gdr.051004-1415)来进行更新,并且把QFE版的MSHTML.DLL复制到"%windir%\$hf_mig$"这个文件夹。反之,如果安装程序检测到系统中当前的MSHTML.DLL为QFE版时,则会用补丁包中QFE版的MSHTML.DLL(文件说明为xpsp.051004-1419)来进行更新。两个文件的版本号都是6.00.2900.2769。
同时在注册表中也可以发现这个特点。在我的系统中反映为两个注册表项:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\Windows XP\SP3\KB896688\Filelist\8和HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\Windows XP\SP3\KB896688\Filelist\50。两个项下的FileName字串值都是"MSHTML.DLL",而Location字串值分别为"C:\WINDOWS\system32"和"c:\windows\$hf_mig$\KB896688\SP2QFE",也就是分别存放GDR和QFE文件的位置。
如果你在安装了GDR版的KB896688补丁之后,又要重新安装一个需要把MSHTML.DLL更新为QFE版的修复程序。但是该修复程序中的MSHTML.DLL版本号比6.00.2900.2769要低,那么这时候更新程序就不会选取补丁包中的MSHTML.DLL来更新,而是到"%windir%\$hf_mig$"去找之前预留的QFE版MSHTML.DLL来更新。所以说一般最好不要轻易删除Windows目录下的"$hf_mig$"文件夹。