摘要: MySQLConnectionconn=null; try{ //MySQLConnectionconn=newMySQLConnection(newMySQLConnectionString("myquest","root","amttgroup").AsString); //实例化一个连接对象其中myquest为数据库名,root为数据库用户名,amttgroup为数据库密码 stringconnstr="DataSource=MySQL;Password=root;UserID=root;Location=localh 阅读全文
posted @ 2011-04-18 22:34 V587 阅读(627) 评论(2) 推荐(0) 编辑
摘要: using System;using System.Data;using System.Data.SqlClient;using System.Configuration;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;using MySQLDriverCS;public partial class _Def 阅读全文
posted @ 2011-04-18 22:33 V587 阅读(510) 评论(0) 推荐(0) 编辑
摘要: MySqlConnection connection = new MySqlConnectio(connectionString); using (MySqlCommand cmd = new MySqlCommand(safeSql, connection)) { try { connection.Open(); return cmd.ExecuteNonQuery(); } catch (Exception ex) { connection.Close(); return 0; } } 阅读全文
posted @ 2011-04-18 22:26 V587 阅读(232) 评论(2) 推荐(0) 编辑
摘要: 1、用MySQLDriverCS连接MySQL数据库先下载和安装MySQLDriverCS,地址:http://sourceforge.net/projects/mysqldrivercs/在安装文件夹下面找到MySQLDriver.dll,然后将MySQLDriver.dll添加引用到项目中注:我下载的是版本是 MySQLDriverCS-n-EasyQueryTools-4.0.1-DotNet2.0.exeusing System;using System.Collections.Generic;using System.ComponentModel;using System.Data; 阅读全文
posted @ 2011-04-18 22:15 V587 阅读(442) 评论(0) 推荐(0) 编辑
摘要: XMLFile1.xml文件如下:view sourceprint?01<?xml version="1.0" encoding="utf-8" ?> 02<root name="rootNode" text="根节点"> 03<node name="node1" text="节点1"> 04<childNode name="childNode1" text="子节点1"> 05<g 阅读全文
posted @ 2011-04-08 00:09 V587 阅读(427) 评论(0) 推荐(0) 编辑
摘要: foreach (TreeNode CNode in LastTree.Nodes) {abc(CNode); } void abc(TreeNode node){ MessageBox.Show(node.Text);foreach(TreeNode child in node.ChildNodes){abc(child);// 递归}} 阅读全文
posted @ 2011-04-08 00:03 V587 阅读(451) 评论(0) 推荐(0) 编辑
摘要: 用两个递归来设置子节点和父节点的状态,如下private void CheckChild(TreeNode node) { if (node.Nodes.Count != 0) { foreach (TreeNode item in node.Nodes) { item.Checked = node.Checked; CheckChild(item); } } } private void CheckParent(TreeNode node) { if (node.Parent != null) { int count = 0; foreach (TreeNode item in node.P 阅读全文
posted @ 2011-04-07 21:40 V587 阅读(863) 评论(0) 推荐(0) 编辑