ITeye博客

xinying

新颖666666 · 共 35 篇文章

xml学习

namespace xml学习 { class Program { static void Main(string args) { #region xml写入1 ////创建了一个空的XDocument对象 ////创建了一个空的文档对象 //XDocument document = new XDocument(); ////1.1c创建一个文档声明 ////第一个参数是版本号 第二个参数是 字体 第三个参数是 表示是否为独立的xml文件 //XDeclaration xDec = new XDeclaration("1.0", "gb2312", "yes"); //document.De…

2015-05-29 21:15 · c#学习记录 · 评论(0)

用反射给触发器添加功能

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 反射记事本 {…

2015-05-28 18:15 · c#学习记录 · 评论(0)

repeater控件实现数据绑定并分页

前台:添加一个Repeater 控件 四个LinkButton 控件 <div class="information"> <asp:Repeater ID="Repeater1" runat="server"> <HeaderTemplate> <asp:Label ID="Label1" runat="server" Text="信息与计算科学"></asp:Label></HeaderTemplate> <ItemTemplate> <div> <image src=""></image> <asp:Label ID="name" runat="server"><%#DataBinder…

2015-05-28 13:51 · c#学习记录 · 评论(0)

反射介绍

static void Main(string args) { #region 反射介绍 //反射:通过动态获取程序集 获取其中的类型元数据 然后访问类型的过程 //反射中一个非常重要的类型就是Type //1.如果获取Type类型的对象? //获取Person类型的Type 对象 Type 对象中就是存放了一些关于某个类型的所有的信息的内容 // //1>当没有对象的时候使用这种方式获取某个类型的Type //Type type =typeof(Person); //2>//当获得对象后就可以使用对象的GetType() 方法来获取指定对象的类型的Type对象 //Person p=new…

2015-05-28 13:50 · c#学习记录 · 评论(0)

list集合中进行排序

namespace list集合中的排序方法 { class Program { static void Main(string args) { // List list = new List () { 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, }; List<Person> list = new List<Person>() { new Person(){Name="wanjgia",Age=19,Email="hkh@.com"}, new Person(){Name="fgd",Age=30,Email="hk/h@.com"}, new Person(){Name…

2015-05-27 13:21 · c#学习记录 · 评论(0)

用接口和委托两种方式实现用户登录

//用委托实现的主要代码 namespace 委托来实现用户登录 { public partial class UCLogin : UserControl { public UCLogin() { InitializeComponent(); } public event LoginDelegate LoginValidating; //点击登录按钮触发的事件 private void button1_Click(object sender, EventArgs e) { //1.采集用户的输入 string uid = textBox1.Text.Trim(); string pwd = …

2015-05-27 12:24 · c#学习记录 · 评论(0)

sqlHelper

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.ConnectionStrings.Conn…

2015-04-22 17:33 · c#学习记录 · 评论(0)

ado.net实现分页和用dataadapter实现增加修改删除

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 { …

2015-04-22 16:19 · c#学习记录 · 评论(0)

用dom的形式访问xml文档一

xml文档: BlodWake XBox 后台代码: XmlDocument doc = new XmlDocument(); doc.Load("../../myMedia.xml");//加载要显示的xml文档 XmlNode root = doc.DocumentElement;//获取文档的根元素 IEnumerator NodePointer = root.GetEnumerator();//支持xmlnode节点上的for each样式迭代功能 XmlNode items; while (NodePointer.MoveNext())//将枚举推荐到下一个元素 { items =…

2014-06-11 21:06 · c#学习记录 · 评论(0)

XmlTextWriter生成xml文件

XmlTextWriter writer = new XmlTextWriter("../../myMedia.xml", null);//文件的生成位置 writer.Formatting = Formatting.Indented;//对如何输出进行格式设置 writer.WriteStartElement("items"); writer.WriteStartElement("item"); writer.WriteAttributeString("rating", "R"); writer.WriteElementString("title", "The Matrix"); writ…

2014-06-11 20:36 · c#学习记录 · 评论(0)

C#中的listview绑定 xml文件中的数据并显示

xml:文件内容 点击的button控件中的内容: private void button1_Click(object sender, EventArgs e) { ListViewItem myitem = new ListViewItem(); listView1.View = View.Details;//listView显示方式 这很重要不然不显示出完全的内容 listView1.Columns.Clear(); listView1.Items.Clear(); listView1.Columns.Add("name",200,HorizontalAlignment.Left); l…

2014-06-11 19:57 · c#学习记录 · 评论(0)

.net中在后台代码中构建html代码在前台显示

目的:从数据库中查出一个表,将表中的name列的值,用表格的形式在,网页中显示, 准备:页面中放一个literal控件,用于绑定拼接的html代码 源代码如下: private void bindTeacher(DataSet ds, Literal literal) { int nameCount = ds.Tables.Rows.Count;//查询的总条数 DataTable dt=ds.Tables; int trTrue = nameCount % 5; ;//判断是信息条数是不是5的倍数 int trCount = nameCount / 5;//需要多少行来显示 每行显示个姓名…

2014-06-08 20:06 · c#学习记录 · 评论(0)

C#中null和""的区别

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.WriteLine(a); 或者用于比较: if(a=="") if(a=…

2013-07-18 16:14 · c#学习记录 · 评论(0)

[DllImport("user32.dll")]

这叫引入user32.dll这个动态连接库。 这个动态连接库里面包含了很多WindowsAPI函数,如果你想使用这面的函数,就需要这么引入。举个例子: private static extern void 函数名(参数,); 函数名就是一个属于user32.dll里的一个函数。完了你就可以用那个函数了。 使用前要引用using System.Runtime.InteropServices; 示例: 程序接收来自用户的字符串并将该字符串显示在消息框中。程序使用从 User32.dll 库导入的 MessageBox 方法。 //using System.Runtime.InteropServi…

2013-07-17 18:19 · c#学习记录 · 评论(0)

解决方案资源管理器中显示bin,Debug等文件夹

1.项目 -- 显示所有文件 2.右击新出现的bin,Debug等文件夹 -- 加入到项目 即可

2013-07-17 17:09 · c#学习记录 · 评论(0)