using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
Hashtable aa = new Hashtable();
private void buttonSave_Click(object sender, EventArgs e)
{
FileStream fs = new FileStream("e:\\400tel
.dat", FileMode.Create);
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(fs, aa);
fs.Close();
}
private void buttonLoad_Click(object sender, EventArgs e)
{
aa.Clear();
FileStream fs = new FileStream("e:\\400tel.dat", FileMode.OpenOrCreate);
BinaryFormatter bf = new BinaryFormatter();
aa = (Hashtable)bf.Deserialize(fs);
fs.Close();
}
//Dictionary<String, String> dic = new Dictionary<String, String>(13000000);
C#连接mysql数据库
string ConnectionString = "server = localhost; user id = XXXX; password = XXXX; database = XXXX";
string sqlString="......(此处sql语句省略)";
using (MySqlConnection connection = new MySqlConnection(connectionString))
{
using (MySqlCommand cmd = new MySqlCommand(sqlString, connection))
{
try
{
connection.Open();
int rows = cmd.ExecuteNonQuery();//执行sql语句
return rows;
}
catch (MySql.Data.MySqlClient.MySqlException e)
{
connection.Close();
throw e;
}
}
}
下载
mysql-connector-net-6.4.3.rar
下载 mysql-connector-net-6.4.3-src.zip
分享到:
相关推荐
序列化与反序列的基本例子,可以直接使用,我描述不出来,强迫我写20个字,郁闷的很!
C#中关于序列化HashTable的具体用法详解
c#两种简单的json类和对象的序列化和解析。一种使用Hashtable序列化和解析;一种使用实体类序列化和解析。需要借助第三方Newtonsoft.Json.dll。
c#数据结构之array,arraylist,hashtable,dictionary
探讨hashtable与dictionary两者的性能及结构区别,并用代码来实现测试。是深入学习数据结构的好的例子。一切源于基础,希望对你有所帮助。
XML序列化这个东西挺搞人的,当你的Class里有Hashtable这样的东西的时候,在序列化的时候,在XmlSerializer serialize = new XmlSerializer(typeof(myClass));这一句上会出来一个“反射类型时出错”的错误。其实就是...
C# .net HashTable
自己写的json字符串转hashtable,或者把hashtable转为json字符
该文档实现了Hashtable在C#中的常用的函数
我们经常用HashTable 来存储将要写入到数据库或者返回的信息,在这之间要不断的进行类型的转化,增加了系统装箱和拆箱的负担,如果我们操纵的数据类型相对确定的化 用Dictionary,TValue> 集合类来存储数据就方便多了...
c#重写HashTable. 开发语言:c#
asp.net下的序列化,支持hashtable
C#之Json字符串转换Hashtable,DataTable,DataSet方法和反转换方法.
c#通讯录hashtable
在C#中应用哈希表(Hashtable) 在哈希表中添加一个key/value键值对:HashtableObject.Add(key,value); 在哈希表中去除某个key/value键值对:HashtableObject.Remove(key); 从哈希表中移除所有元素: ...
// Hashtable2.cs // 给Hashtable添加元素的示例 using System; using System.Collections; public class Test { public static void Main() { Hashtable table = new Hashtable(); table.Add("Sunday", "星期...
本文中将从基础角度讲解HashTable、Dictionary的构造和通过程序进行插入读取对比
主要介绍了C#中哈希表(HashTable)用法,简单讲述了哈希表的原理并结合实例形式详细分析了C#针对哈希表进行添加、移除、判断、遍历、排序等操作的实现技巧,需要的朋友可以参考下
主要介绍了C# ArrayList、HashSet、HashTable、List、Dictionary的区别的相关知识点内容,有需要朋友们参考下。