虎克的博客

Enthusiasm Biogeography-Biodiversity Informatics-Data Sciences

如何获取GridView隐藏列的值

| Comments

对于经常使用GridView的朋友们可能经常遇到在GridView上绑定某些列的数据,用于进行嵌套控件从这些列中取值进行相应的操作,但是又不希望这些列的数据对客户端可见。我们经常的处理方法是将这些列的Visible属性设置为false。但是这样做就带来了对这些隐藏列的取值问题。下面就是解释如何处理这些隐藏列的两种情况,一是隐藏主键列字段的取值;二是隐藏非主键列字段的取值。两者实际上都是通过设置其字段为主键DataKeyNames属性来实现。数据库使用NorthWind数据库

运行效果

2009-05-25_000741

Default.aspx页面

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

 

<!DOCTYPE html PUBLIC "–//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;>

<html xmlns="http://www.w3.org/1999/xhtml&quot;>

<head runat="server">

    <title></title>

</head>

<body>

    <form id="form1" runat="server">

    <div>

        <asp:GridView ID="gvMaster" runat="server" AutoGenerateColumns="False" CellPadding="4"

            DataKeyNames="ProductID" DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="None"

            Width="266px" AllowPaging="True">

            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />

            <RowStyle BackColor="#EFF3FB" />

            <Columns>

                <asp:CommandField ShowSelectButton="True" />

                <asp:BoundField DataField="ProductID" HeaderText="ProductID" InsertVisible="False"

                    ReadOnly="True" SortExpression="ProductID" Visible="False" />

                <asp:BoundField DataField="CategoryID" HeaderText="CategoryID" InsertVisible="False"

                    ReadOnly="True" SortExpression="CategoryID" Visible="False" />

                <asp:BoundField DataField="ProductName" HeaderText="ProductName" SortExpression="ProductName" />

                <asp:BoundField DataField="UnitPrice" HeaderText="UnitPrice" SortExpression="UnitPrice" />

                <asp:TemplateField HeaderText="Select">

                    <ItemTemplate>

                        <asp:CheckBox ID="CheckBox1" runat="server" />

                    </ItemTemplate>

                </asp:TemplateField>

            </Columns></p

   original link:
   <a href='http://Apiaceae.github.io/blog/2009/05/25/%E5%A6%82%E4%BD%95%E8%8E%B7%E5%8F%96GridView%E9%9A%90%E8%97%8F%E5%88%97%E7%9A%84%E5%80%BC/'>http://Apiaceae.github.io/blog/2009/05/25/%E5%A6%82%E4%BD%95%E8%8E%B7%E5%8F%96GridView%E9%9A%90%E8%97%8F%E5%88%97%E7%9A%84%E5%80%BC/</a><br/>
   &nbsp;written by <a href='http://Apiaceae.github.io'>Hooker</a>
   &nbsp;posted at <a href='http://Apiaceae.github.io'>http://Apiaceae.github.io</a>
   </p>

ASP.NET的标准服务器控件-应用(一)

| Comments

1、标签控件Label Control

1.1 示例代码

<asp:Label id="labMsg" runat="server" text="hello"/>

 

labMsg.Text = "<p>This is the <i>First</i> line";

labMsg.Text += "<br>" + "This is second line</p>";

 

标签控件在HTML的返回形式是<span id="labMsg">hello</span>

1.1 Assigning an Access Key

例子如下:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="LabelHotKeys.aspx.cs" Inherits="LabelHotKeys" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h1>
            Using AccessKey for Controls</h1>
        <asp:Label ID="labName" runat="server" AccessKey="N" AssociatedControlID="txtName"
            Text="&lt;u>N</u>ame">
        </asp:Label>
        <asp:TextBox ID="txtName" runat="server"></asp:TextBox><br />
        <asp:Label ID="labMonth" runat="server" AccessKey="M" AssociatedControlID="drpMonth"
            Text="&lt;u>M</u>onth">
        </asp:Label>
        <asp:DropDownList ID="drpMonth" runat="server">
            <asp:ListItem>January</asp:ListItem>
            <asp:ListItem>February</asp:ListItem>
            <asp:ListItem>March</asp:ListItem>
        </asp:DropDownList>
    </div>
    </form>
</body>
</html>

代码说明:红色代码的含义是当在浏览器显示结果的时候使用ALT+N(AccessKey定义的)鼠标指针的焦点转移到文本框控件txtName(AssociatedControlID)上。但是不能定

   original link:
   <a href='http://Apiaceae.github.io/blog/2009/05/18/ASP.NET%E7%9A%84%E6%A0%87%E5%87%86%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%8E%A7%E4%BB%B6-%E5%BA%94%E7%94%A8%28%E4%B8%80%29/'>http://Apiaceae.github.io/blog/2009/05/18/ASP.NET%E7%9A%84%E6%A0%87%E5%87%86%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%8E%A7%E4%BB%B6-%E5%BA%94%E7%94%A8%28%E4%B8%80%29/</a><br/>
   &nbsp;written by <a href='http://Apiaceae.github.io'>Hooker</a>
   &nbsp;posted at <a href='http://Apiaceae.github.io'>http://Apiaceae.github.io</a>
   </p>

ASP.NET的标准服务器控件-应用(二)

| Comments

1、目录

2、一些另外的标准ASP.NET服务器控件概述

2.1 控件列表

2.2 对象模型

Control类除了有一个visibility属性外,没有其他与用户界面相关的属性函数,它提供所有控件所需要的基本特征,例如:ID,子控件集合,共有的控件事件。对比来说,WebControl类主要提供一些控件的外表和行为的属性,比如前景色,高度和样式表等(ForeColor, Height, CssClass, etc.).

3、Panel Control

Panel控件经常用于创建一些控件组行为,比如定义页面中某个区域的外表,显示或隐藏页面中一群控件。

3.1 属性

Panel控件和HTML源码显示为<fieldset>和<legend>元素,<fieldset>用来定义一个表单中表单组,从而把一个表单分割成小的单元,在页面的显示效果是一个矩形框。<legend>元素定义小表单组的标题. 如下图所示

3.2 示例代码

PizzaPanelTest.aspx

<div id="left">
        <asp:Panel ID="panPizza" runat="server" Width="25em" GroupingText="Pizza Order Form">
            <dl>
                <dt>
                    <asp:Label ID="labCustomer" runat="server" Text="Customer" AccessKey="C" AssociatedControlID="txtCustomer" />
                </dt>
                <dd>
                    <asp:TextBox ID="txtCustomer" runat="server" />
                </dd>
                <dt>
                    <asp:Label ID="labPhone" runat="server" Text="Phone" AssociatedControlID="txtPhone" />
                </dt>
                <dd>
                    <asp:TextBox ID="txtPhone" runat="server" Columns="10" />
                </dd>
                <dt>
                    <asp:Label ID="labDelivery" runat="server" Text="Delivery" AssociatedControlID="chkDelivery" />
                </dt>
   original link:
   <a href='http://Apiaceae.github.io/blog/2009/05/17/ASP.NET%E7%9A%84%E6%A0%87%E5%87%86%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%8E%A7%E4%BB%B6-%E5%BA%94%E7%94%A8%28%E4%BA%8C%29/'>http://Apiaceae.github.io/blog/2009/05/17/ASP.NET%E7%9A%84%E6%A0%87%E5%87%86%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%8E%A7%E4%BB%B6-%E5%BA%94%E7%94%A8%28%E4%BA%8C%29/</a><br/>
   &nbsp;written by <a href='http://Apiaceae.github.io'>Hooker</a>
   &nbsp;posted at <a href='http://Apiaceae.github.io'>http://Apiaceae.github.io</a>
   </p>

ASP.NET的一些基本概念和术语-ASP.NET如何工作

| Comments

目录

ASP.NET的事件模式(ASP.NET Event Model)

事件处理器(event handler):event handler 用来决定当一个事件被激发是的处理方式,比如当用户点击鼠标或者是用户从一个下拉列表中选中某个选项等等。

在.NET Framework中, 所有的事件处理器都有一个特定的方法签名(method signature)—也就是说方法的返回类型(return type)和参数(parameters)。事件处理器都是void方法,它接收两个参数:一个对象参数(object parameter)和事件声明参数(EventArgs parameter)。对象参数指激发事件的对象。例如:如果你在不同的控件使用相同的event handler,对象参数将用来判断是哪个控件激发了该事件。EventArgs parameter包含说明特定事件的信息。例如:ImageClickEventArgs parameter包含用户点击某个图片的位置信息(x和y坐标)。ASP.NET的事件处理过程不同于一般Windows应用程序在于事件的激发是发生在客户端,然后传输到服务器端进行处理。

回传(Postback)

postbackis the process by which the browser posts information
back to itself (i.e., posts information back to the server by requesting the same page). Postback in ASP.NET only occurs within Web Forms (i.e., within a form element with runat=server), and only server controls postback information to the server. Each cycle in which information is displayed and then posted back to the server is sometimes also called a round trip.

 

Page and Control Events

View State and Control State

It is a specially encoded string that is used to retain page and form information between requests and is stored within a hidden HTML <input> element. All page elements not posted back via the standard HTTP POST mechanism are stored within this string.

Page Lifecycle

Page and control events occur in a certain order, which is called the page lifecycle.

Cross-Page Posting

ASP.NET Code Compilation

The Page Class

Request: The Request property of the Page class returns an HttpRequest object. This HttpRequest represents the HTTP values sent by the browser with its request. It contains members for retrieving query string or form parameters, cookie data, as well as information about the requesting browser.

HttpRequest class

Response: The HttpResponse class represents the server’s HTTP response to the current request.

HttpResponse

Server: The Server property of the Page class returns an HttpServerUtility object.

HttpServerUtility class

Response.Redirect Versus Server.Transfer

两种方法都是重新定向到指定的页面,前者要形成一个客户端到服务器的响应Round trip,因此客户端的浏览器地址栏会出现更新;后者允许较快,因为它是直接加载请求的页面,因此不存在浏览器地址栏的更新,

ASP.NET Application Lifecycle

1、User Requests ASP.NET Resource from Server

An ISAPI extension is a Windows DLL that can be directly invoked by
a URL and that interacts and works with a request to a Web server; for ASP.NET,
the extension is aspnet_isapi.dll. An ISAPI filter, on the other hand, is a

Windows DLL that modifies the incoming and outgoing data stream to and from
IIS; for ASP.NET, the filter is aspnet_filter.dll, and is used only to preprocess
cookieless session state.

 

ASP.NET worker process (aspnet_wp.exe), which then takes over and controls the execution of the request. This worker process is a small Win32 executable that loads and hosts the CLR. Generally, there is only one instance of this process running on the machine; that is, all future requests are routed through this one worker process (see Figure 2.15). However, if there are multiple CPUs on the Web server, each CPU can run a separate single worker process.

IIS 6 generic worker process (named w3wp.exe)

IIS application pool

生物多样性信息学参考文献

| Comments

网站地址: http://www.taxondata.org/referencias/

一个非常有用的关于生物多样性信息学参考文献的网站,网站上面提供了直接导入EndNote等文献管理工具的方法

2009-05-14_181308

快速的将这些重要文献收归到自己的文献数据库

   original link:
   <a href='http://Apiaceae.github.io/blog/2009/05/15/%E7%94%9F%E7%89%A9%E5%A4%9A%E6%A0%B7%E6%80%A7%E4%BF%A1%E6%81%AF%E5%AD%A6%E5%8F%82%E8%80%83%E6%96%87%E7%8C%AE/'>http://Apiaceae.github.io/blog/2009/05/15/%E7%94%9F%E7%89%A9%E5%A4%9A%E6%A0%B7%E6%80%A7%E4%BF%A1%E6%81%AF%E5%AD%A6%E5%8F%82%E8%80%83%E6%96%87%E7%8C%AE/</a><br/>
   &nbsp;written by <a href='http://Apiaceae.github.io'>Hooker</a>
   &nbsp;posted at <a href='http://Apiaceae.github.io'>http://Apiaceae.github.io</a>
   </p>

奇怪的问题

| Comments

这几天电脑老是出现这样的问题,怎么回事啊?

   original link:
   <a href='http://Apiaceae.github.io/blog/2009/05/14/%E5%A5%87%E6%80%AA%E7%9A%84%E9%97%AE%E9%A2%98/'>http://Apiaceae.github.io/blog/2009/05/14/%E5%A5%87%E6%80%AA%E7%9A%84%E9%97%AE%E9%A2%98/</a><br/>
   &nbsp;written by <a href='http://Apiaceae.github.io'>Hooker</a>
   &nbsp;posted at <a href='http://Apiaceae.github.io'>http://Apiaceae.github.io</a>
   </p>

DataSet绑定数据到HTML的Table

| Comments

执行效果图

Default2.aspx页面代码

 

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>

 

<!DOCTYPE html PUBLIC "–//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;>

 

<html xmlns="http://www.w3.org/1999/xhtml&quot;>

<head runat="server">

    <title></title>

</head>

<body>

    <form id="form1" runat="server">

    <div id="display" runat="server">Table Will Go Here</div>

 

    </form>

</body>

</html>

Default.aspx.cs后台代码

 

   1:  using System;

   2:  using System.Data;

   3:  using System.Data.SqlClient;

   4:  using System.Web.Configuration;

   5:   

   6:  public partial class Default2 : System.Web.UI.Page

   7:  {

   8:      protected void Page_Load(object sender, EventArgs e)

   9:      {

  10:          // Connection set up

  11:          String strConnection = WebConfigurationManager.ConnectionStrings["NorthWind"].ConnectionString;

  12:   

  13:          SqlConnection objConnection = new SqlConnection(strConnection);

  14:          String strSQL = "SELECT ProductName, UnitsInStock FROM Products";

  15:          // DataAdapter setup

  16:          SqlDataAdapter objAdapter = new SqlDataAdapter(strSQL, objConnection);

  17:          // DataSet & Adapter & Table

  18:          DataSet objDataSet = new DataSet();

  19:          objAdapter.Fill(objDataSet, "dtProducts");

  20:          String strResultsHolder;

  21:          strResultsHolder = "<table width=80% border=1>";

  22:          strResultsHolder += "<tr>";

  23:          foreach (DataColumn c in objDataSet.Tables["dtProducts"].Columns)

  24:          {

  25:              strResultsHolder += "<td>" + c.ColumnName + "</td>";

  26:          }

  27:          strResultsHolder += "</tr>";

  28:          int value, blankValue;

  29:          foreach (DataRow r in objDataSet.Tables["dtProducts"].Rows)

  30:          {

  31:              value = 100 * Convert.ToInt32(r["UnitsInStock"]) / 125;

   original link:
   <a href='http://Apiaceae.github.io/blog/2009/05/14/DataSet%E7%BB%91%E5%AE%9A%E6%95%B0%E6%8D%AE%E5%88%B0HTML%E7%9A%84Table/'>http://Apiaceae.github.io/blog/2009/05/14/DataSet%E7%BB%91%E5%AE%9A%E6%95%B0%E6%8D%AE%E5%88%B0HTML%E7%9A%84Table/</a><br/>
   &nbsp;written by <a href='http://Apiaceae.github.io'>Hooker</a>
   &nbsp;posted at <a href='http://Apiaceae.github.io'>http://Apiaceae.github.io</a>
   </p>

Word 使用技巧收集分享

| Comments

2009-05-13_140727 Word是我们平常用的最多的Office软件之一,也是很多朋友平时工作时用得最多的工具了。今天我们收集了一些不错的Word技巧,希望能帮助大家提供一下工作的效率和方便性吧……

把文字替换成图片

首 先把图片复制到 剪贴板中,然后打开替换对话框,在“查找内容”框中输入将被替换的文字,接着在“替换为”框中输入“^c”(注意:输入的一定要是半角字符,c要小写), 单击替换 即可。说明:“^c”的意思就是指令WordXP以剪贴板中的内容替换“查找内容”框中的内 容。按此原理,“^c”还可替换包括回车符在内的任何可以复制到剪贴板的可视内容,甚至Excel表格。

三招去掉页眉那条横线

1、在页眉中,在“格式”-“边框和底纹”中设置表格和边框为“无”,应用于“段落”
2、同上,只是把边框的颜色设置为白色(其实并没有删的,只是看起来没有了)
3、在“样式”栏里把“页眉”换成“正文”就行了——强烈推荐!
会多出—(两个横杠) 这是用户不愿看到的,又要多出一步作删除—
解决方法:替换时在前引号前加上一个空格 问题就解决了
插入日期和时间的快捷键

Alt+Shift+D:当前日期
Alt+Shift+T:当前时间
批量转换全角字符为半角字符

首先全选。然后“格式”→“更改大小写”,在对话框中先选中“半角”,确定即可

Word启动参数简介

单击“开始→运行”命令,然后输入Word所在路径及参数确定即可运行,如“C:\ PROGRAM FILES \MICROSOFT Office \Office 10\ WINWord.EXE /n”,这些常用的参数及功能如下:
/n:启动Word后不创建新的文件。
/a:禁止插件和通用模板自动启动。
/m:禁止自动执行的宏。
/w:启动一个新Word进程,独立与正在运行的Word进程。
/c:启动Word,然后调用Netmeeting。
/q:不显示启动画面。
另外对于常需用到的参数,我们可以在Word的快捷图标上单击鼠标右键,然后在“目标”项的路径后加上该参数即可。

快速打开最后编辑的文档

如果你希望Word在启动时能自动打开你上次编辑的文档,可以用简单的宏命令来完成:
(1)选择“工具”菜单中的“宏”菜单项,单击“录制新宏”命令打开“录制宏”对话框;
(2)在“录制宏”对话框中,在“宏名”输入框中输入“autoexec”,点击“确定”;
(3)从菜单中选择“文件”,点击最近打开文件列表中显示的第一个文件名;并“停止录制”。保存退出。下次再启动Word时,它会自动加载你工作的最后一个文档。

格式刷的使用

1、设定好文本1的格式。
2、将光标放在文本1处。
3、单击格式刷按钮。
4、选定其它文字(文本2),则文本2的格式与文本1 一样。
若在第3步中单击改为双击,则格式刷可无限次使用,直到再次单击格式刷(或按Esc键)为止。

删除网上下载资料的换行符(象这种“↓”)

在查找框内输入半角l(是英文状态下的小写L不是数字1),在替换框内不输任何内容,单击全部替换,就把大量换行符删掉啦。
选择性删除文件菜单下的最近使用的文件快捷方式。
工具→选项→常规把“列出最近使用文件数改为0”可以全部删除,若要选择性删除,可以按ctrl+Alt+ -三个键,光标变为一个粗减号后,单击文件,再单击要删除的快捷方式就行了。

建立一个矩形选区

一般的选区建立可用鼠标左键,或用shift键配合pgup、pgdn、home、end、箭头等功能键,当复制一个规则的矩形区域时,可先按住Alt键,然后用鼠标左键来选。我一般用此来删除段首多余的成块的空格。

将字体快速改为上标或下标的方法

本人在一次无意间发现了这个方法,选定你要下标的字,然后在英文状态下按住Ctrl,再按一下BASKSPACE旁的+/=的键,就可以了。上标只要在按Ctrl的同时也按住Shift,大家可以试试。

让Word表格快速一分为二

将光标定位在分开的表格某个位置上,按下“Ctrl+Shift+Enter”组合键。这时你就会发现表格中间自动插入一个空行,这样就达到了将一个表格一分为二的目的。

用Word来拆字

首 先点击“工具/自定义/命令/分解图片”,按住鼠标左键把它拖放到工具栏任意位置即可;然后点击“插入/图片/艺术字”,例如输入空心字“心”,选择该“ 心”字剪切,在选择性粘贴中选图片(Windows图元文件),选中该字,点击工具栏中的“分解图片”按钮,这样可以选择“心”中的任意笔画进行一笔一画 的拆分了。

快速删除段前段后的任意多个空格

选定这些段段落,单击居中按钮,然后再单击原来的那种对齐方式按钮(如果原来是居中对齐的,先单击其它对齐方式按钮,再单击居中按钮就行了),是不是这些空格全不见了?

只要打开WORD新建一个空文档的时候,出现的不是空的文档,而是我以前打的一份文档

首先:将资源管理器设置为显示所有文件和文件夹;
然后:
C:\Documents and Settings\Administrator\Application Data\Microsoft\Templates文件夹下将所有Normal.doc文件删掉;
然后:OK(XP系统)

快速输入平方的方法

先输入2,然后选重后,按ctrl加shift加+就可以了.

WORD中表格的选择性录入

1.设置好表格,选定表格-视图-工具-窗体-插入下拉型窗体域
2.输入数据,完成
3.点击锁按钮,保护,输入完后再点击进行其它的输入.
标点符号的全角/半的转换用:Ctrl+.
数字字母的全角/半的转换用:Shift+空格

轻松了解工具栏按钮的作用

按下“shift+F1”键,鼠标指针旁多了一个“?”号,想知道哪个按钮的作用,就用鼠标单击哪个。

要经常在文档中插入自己公司的信息

公司名称、公司住址、联系电话、联系人姓名、QQ号码
可以先选定这些内容,再单击工具→自动更正→在替换框中输入标记名称(如“公司信息”)→添加→确定,以后凡是在文档中要用到这个信息的地方键入“公司信息”(不要引号)这几个字后就自动替换成:
公司名称、公司住址、联系电话、联系人姓名、QQ号码
说明:有些输入法不支持这个功能,键入标记名称后要按一下空格才行。

快速换页的方法

双击某页的右下脚,光标即可定位在那里,然后按回车直到换页。ctrl+回车点插入按纽,分隔符,选中分页符,然后确认就OK了 !!!

表格的简单调整宽度

鼠标放在表格的右边框上带鼠标变成可以调整大小的时候
双击
根据表格内的内容调节表格大小

代替金山词霸

点工具——语言——翻译,在右边出现的搜索框中输入要查的单词,回车就可以翻译了。可以选择英语翻成中文或中文翻成英语。
第一次使用可能要安装。

[Alt]键实现标尺的精确定位

如 果你经常使用水平标尺来精确定位标签、页边框、首字缩进及页面对象的位置,那么你点击标尺设置页边框或标签时,您只可以将其设置为1字符或2字符,但不能 设为1.5字符!要想设置更为精确的度量单位(例如百分之几字符),在按住[Alt]键的同时,点击并移动标尺或边框,此时标尺将用数字精确显示出当前的 位置为百分之几字符位置。

用“记事本”去除格式

网 页上COPY下来的东西往往都是有网格的,如果直接粘贴在WORD中会杂乱无章。先粘贴到记事本当中,再粘贴到WORD中,就可以去除网格等格式,再全选 选择清除格式,居中再取消居中即可取消所有格式。可以直接在WORD中进行:(菜单)编辑/选择性粘贴……/无格式文本/确定。这样省事多了。

快速将文档转换成图片

先把欲想转换的文档保存退出.如:保存在桌面 <

   original link:
   <a href='http://Apiaceae.github.io/blog/2009/05/13/Word+%E4%BD%BF%E7%94%A8%E6%8A%80%E5%B7%A7%E6%94%B6%E9%9B%86%E5%88%86%E4%BA%AB/'>http://Apiaceae.github.io/blog/2009/05/13/Word+%E4%BD%BF%E7%94%A8%E6%8A%80%E5%B7%A7%E6%94%B6%E9%9B%86%E5%88%86%E4%BA%AB/</a><br/>
   &nbsp;written by <a href='http://Apiaceae.github.io'>Hooker</a>
   &nbsp;posted at <a href='http://Apiaceae.github.io'>http://Apiaceae.github.io</a>
   </p>

Vs2010虚拟机登陆帐户和密码

| Comments

o Administrator: TFSSETUP, password: 1Setuptfs (use this account to explore the CTP)

o Administrator: Administrator,password: P2ssw0rd

o User: TFSREPORTS, password: 1Reports

o User: TFSSERVICE, password: 1Service

   original link:
   <a href='http://Apiaceae.github.io/blog/2009/05/13/vs2010%E8%99%9A%E6%8B%9F%E6%9C%BA%E7%99%BB%E9%99%86%E5%B8%90%E6%88%B7%E5%92%8C%E5%AF%86%E7%A0%81/'>http://Apiaceae.github.io/blog/2009/05/13/vs2010%E8%99%9A%E6%8B%9F%E6%9C%BA%E7%99%BB%E9%99%86%E5%B8%90%E6%88%B7%E5%92%8C%E5%AF%86%E7%A0%81/</a><br/>
   &nbsp;written by <a href='http://Apiaceae.github.io'>Hooker</a>
   &nbsp;posted at <a href='http://Apiaceae.github.io'>http://Apiaceae.github.io</a>
   </p>

XML学习笔记(九):XML和ADO.NET

| Comments

将DataSet的内容存储为XML文件:

WriteXml(), WriteXmlSchema(), GetXml(), GetXmlSchema()

XmlWriteMode的几个主要的属性

IgnoreSchema: 将DataSet内容写入XML文件,不包括XSD架构信息

WriteSchema: 同时将DataSet内容和XSD架构信息写入
DiffGram: 写入为DiffGram格式

Saving Only the Schema:仅仅写入XSD架构信息,不包括实际的数据

示例如下:

2009-05-12_161852

 
DataSetWriteXML.aspx
 
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DataSetWriteXML.aspx.cs"

    Inherits="DataSetWriteXML" %>

 

<!DOCTYPE html PUBLIC "–//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;>

<html xmlns="http://www.w3.org/1999/xhtml&quot;>

<head runat="server">

    <title></title>

</head>

<body>

    <form id="form1" runat="server">

    <div>

        <fieldset title="DataSet to XML">

            <asp:TextBox ID="TextBox1" runat="server" Height="20px" Width="284px"></asp:TextBox>

            <br />

            <asp:RadioButtonList ID="RadioButtonList1" runat="server">

                <asp:ListItem Value="0">No Schema</asp:ListItem>

                <asp:ListItem Value="1">With Schema</asp:ListItem>

                <asp:ListItem Value="2">DiffGram</asp:ListItem>

                <asp:ListItem Value="3">Only Schema</asp:ListItem>

            </asp:RadioButtonList>

            <br />

            <asp:Button ID="Button1" runat="server" Text="Write to XML" OnClick="Button1_Click" />

            <asp:Button ID="Button2" runat="server" Text="Load XML" OnClick="Button2_Click" />

        </fieldset>

    </div>

    </form>

</body>

</html>

DataSetWriteXML.aspx.cs

   1:  using System;

   2:  using System.Collections.Generic;

    
      
    
    Blog Archives