易截截图软件、单文件、免安装、纯绿色、仅160KB

How to use MySql via Linq to SQL

The vs2008 and vs2010 don't support the generation LINQ to SQL business objects from a MySQL database, if you drop a MySql table to a Linq to Sql Class, it will popup a "The selected object(s) use an unsupported data provider" error.
Generation tool DBLinq
DbLinq is a LINQ to SQL data context provider and allows you to create LINQ to SQL business objects from a MySQL database and perform LINQ queries directly against MySQL tables. Utilizing LINQ, it functions in the same way as a typical SQL Server data layer.
a) Download DBLinq from: http://code.google.com/p/dblinq2007/downloads/list
b) Run the LINQ to SQL generation tool DbMetal.exe as follows:
DbMetal.exe -provider=MySql -database:MyDatebase -server:you host computer -user:mysql user -password:you pwd -namespace:mysqllinq -code:mysqllinq.cs -sprocs
Modify the generated file
The generated file can't be use in project right now, we must take some modification on it.
a) Delect all code with #if !MONO_STRICT(take MONO_STRICT as True is ok).
b) Delete the constructors from the DataContext class and add the following constructor:
        public MyDBDataContext()
            : base(new MySqlConnection(ConfigurationManager.ConnectionStrings["MyDb"].ConnectionString))
        {
        OnCreated();
        }
c) For "Incorrect AutoSync specification for member" error, we should set AutoSync of pk field as AutoSync.OnInsert, the full configuration for pk field:
[Column(Storage = "_userID", Name = "userId", DbType = "int", IsPrimaryKey = true, AutoSync = AutoSync.OnInsert, CanBeNull = false)]
As the .NET compiler will convert the code into a SQL Server syntax statement, run this code under MySql will throw error(Like this issue:http://lists.mysql.com/mysql/215385


相关文档:

SSH+MySQL开发中的中文乱码问题

一、表单提交乱码解决方法
    表单中含有中文提交乱码,对于字母和数字则不会乱码,我选用的字符集utf-8(以下同)。
 1、在apache-tomcat-6.0.18\webapps\examples\WEB-INF\classes\filters目录下找到文件SetCharacterEncodingFilter.java 和RequestDumperFilter.java文件,并将其复制到项目src ......

Mysql中文乱码问题之分析

Mysql中文乱码问题
之前被mysql中总是出现中文乱码搞得云里雾里,在网上也搜了些相关资料,可结果更让我觉得字符集的转换是相当复杂,甚至有了抵触心理,不过还好在最后搜到几篇经典的文章,经过研读总算明白过来!好文章,不敢独享,现将文章稍作整理与大家分享。
字符集基本概念:
http://home.phpchina.com/space.php ......

Mysql替代解决方案Cassandra

http://incubator.apache.org/cassandra/
http://zh.wikipedia.org/wiki/Cassandra
Apache Cassandra是一套开源分布式数据库管理系统。它最初由Facebook开发,用于储存特别大的数据。
主要特性:
分布式
基于column的结构化
高伸展性
Cassandra的主要特点就是它不是一个数据库,而是由一堆数据库节点共同构成的一 ......

MySQL存储引擎

MySQL常用的存储引擎为MyISAM、InnoDB、MEMORY、MERGE,其中InnoDB提供事务安全表,其他存储引擎都是非事务安全表。
MyISAM是MySQL的默认存储引擎。MyISAM不支持事务、也不支持外键,但其访问速度快,对事务完整性没有要求。
InnoDB存储引擎提供了具有提交、回滚和崩溃恢复能力的事务安全。但是比起MyISAM存储引 ......

MySQL行锁深入研究

      做项目时由于业务逻辑的需要,必须对数据表的一行或多行加入行锁,举个最简单的例子,图书借阅系统。假设 id=1 的这本书库存为 1 ,但是有 2 个人同时来借这本书,此处的逻辑为 :
Select restnum from book where id =1 ;
-- 如果 restnum 大于 0 ,执行 update
Update boo ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号