- 浏览: 31380 次
- 性别:
最新评论
文章列表
namespace xml学习
{
class Program
{
static void Main(string[] args)
{
#region xml写入1
////创建了一个空的XDocument对象
////创建了一个空的文档对象
//XDocument document = new XDocument();
////1.1c创建一个文档声明
////第一个参数是版本号 第二个参数是 字体 ...
用反射给触发器添加功能
- 博客分类:
- c#学习记录
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using System.Reflection;
using MyNotepadInterface;
namespace 反射记事本
{ ...
repeater控件实现数据绑定并分页
- 博客分类:
- c#学习记录
前台:添加一个Repeater 控件 四个LinkButton 控件
<div class="information">
<asp:Repeater ID="Repeater1" runat="server">
<HeaderTemplate>
<asp:Label ID="Label1" runat="server" Text="信 ...
static void Main(string[] args)
{
#region 反射介绍
//反射:通过动态获取程序集 获取其中的类型元数据 然后访问类型的过程
//反射中一个非常重要的类型就是Type
//1.如果获取Type类型的对象?
//获取Person类型的Type 对象 Type 对象中就是存放了一些关于某个类型的所有的信息的内容
//
//1>当 ...
list集合中进行排序
- 博客分类:
- c#学习记录
namespace list集合中的排序方法
{
class Program
{
static void Main(string[] args)
{
// List<int> list = new List<int>() { 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, };
List<Person> list = new List<Person>() {
new Person(){Name="wanj ...
用接口和委托两种方式实现用户登录
- 博客分类:
- c#学习记录
-------------------------------------------------------------------
//用委托实现的主要代码
namespace 委托来实现用户登录
{
public partial class UCLogin : UserControl
{
public UCLogin()
{
InitializeComponent();
}
public event LoginDelegate LoginValidating;
// ...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
namespace sqlHelper
{
public static class SqlHelper
{
//string connStr = System.Configuration.ConfigurationManager.Conn ...
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Configuration;
using System.Data.SqlClient;
namespace _20150408
{
public partial class Form1 : Form ...
用dom的形式访问xml文档一
- 博客分类:
- c#学习记录
xml文档:
<items>
<item rating="R">
<title>The Matrix</title>
<format>DVD</format>
</item>
<item><title>BlodWake</title><format>XBox</format></item>
<item>
<title>fdjfjlafalj ...
XmlTextWriter生成xml文件
- 博客分类:
- c#学习记录
XmlTextWriter writer = new XmlTextWriter("../../myMedia.xml", null);//文件的生成位置
writer.Formatting = Formatting.Indented;//对如何输出进行格式设置
writer.WriteStartElement("items");
writer.WriteStartElement("item");
writer.WriteAttribut ...
xml:文件内容
<?xml version="1.0" encoding="utf-8" ?>
<employees>
<nol>
<name> ma jin hu</name>
<zip> 239900</zip>
<address> feng huang street </address>
<city> chu zhou</city>
</nol>
<nol2>
< ...
目的:从数据库中查出一个表,将表中的name列的值,用表格的形式在,网页中显示,
准备:页面中放一个literal控件,用于绑定拼接的html代码
源代码如下:
private void bindTeacher(DataSet ds, Literal literal)
{
int nameCount = ds.Tables[0].Rows.Count;//查询的总条数
DataTable dt=ds.Tables[0];
int trTrue = nameCount % 5; ;//判断是信息条数是不是5 ...
C#中null和""的区别
- 博客分类:
- c#学习记录
string str = null 没有创建内存空间,str中存放的是空引用针;
string str = "" 创建了内存空间,str中存放的是指向堆中的指针。
简单地说: string str =""; 给你一张白纸; string str = null; 连白纸也没有。
string.Empty就相当于"" 一般用于字符串的初始化 比如: string a;
Console.WriteLine(a);//这里会报错,因为没有初始化a
而下面不会报错: string a=string.Empty; Console ...
这叫引入user32.dll这个动态连接库。
这个动态连接库里面包含了很多WindowsAPI函数,如果你想使用这面的函数,就需要这么引入。举个例子:
[DllImport("user32.dll")]
private static extern void 函数名(参数,[参数]);
函数名就是一个属于user32.dll里的一个函数。完了你就可以用那个函数了。
使用前要引用using System.Runtime.InteropServices;
示例:
程序接收来自用户的字符串并将该字符串显示在消息框中。程序使用从 User32.dll 库导入的 MessageBo ...
1.项目 -- 显示所有文件
2.右击新出现的bin,Debug等文件夹 -- 加入到项目 即可