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

Mysql的DBHelper.cs

using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using MySql.Data.MySqlClient;
namespace i_salesDAL
{
public class DBHelper
{
//引导数据库连接数据库调用Web.Config文件
private static MySqlConnection connection;
//创建连接
public static MySqlConnection Connection
{
get
{
MySqlConnection myConn = new MySqlConnection("server=localhost;user id=root;password=root;database=google;CharSet=gb2312;");
string connectionString = myConn.ConnectionString;
if (connection == null)
{
connection = new MySqlConnection(connectionString);
//打开连接
connection.Open();
}
else if (connection.State == System.Data.ConnectionState.Closed)
{
connection.Open();
}
else if (connection.State == System.Data.ConnectionState.Broken)
{
connection.Close();
connection.Open();
}
return connection;
}
}
//(无参)返回执行的行数(删除修改更新)
public static int ExecuteCommand(string safeSql)
{
MySqlCommand cmd = new MySqlCommand(safeSql, Connection);
int result = cmd.ExecuteNonQuery();
return result;
}
//(有参)
public static int ExecuteCommand(string sql, params MySqlParameter[] values)
{
MySqlCommand cmd = new MySqlCommand(sql, Connection);
cmd.Parameters.AddRange(values);
return cmd.ExecuteNonQuery();
}
//(无参)返回第一行第一列(删除修改更新)
public static int GetScalar(string safeSql)
{
MySqlCommand cmd = new MySqlCommand(safeSql, Con


相关文档:

MySQL优化总结


表设计方面:
1、字段名尽量简化,不要超过18个字符
2、使用尽量小的数据类型,例如:MEDIUMINT比INT少占用25%空间
3、字段类型应尽量避免设置成可变长度,如:VARCHAR、BLOB、TEXT
4、用于比较的不同字段,应设置相同的类型及长度
5、尽可能将字段声明为NOT NULL,并指定DEFAULT
6、主索引尽可能短
7、仅创建真正 ......

MySQL Cluster Core Concepts


NDBCLUSTER
(also known as NDB
) is an in-memory
storage engine offering high-availability and data-persistence
features.

The NDBCLUSTER
storage engine can be
configured with a range of failover and load-balancing options,
but it is easiest t ......

MySQL Cluster Multi Computer How To


This section is a “How-To
” that describes the basics
for how to plan, install, configure, and run a MySQL Cluster.
Whereas the examples in
Chapter 3, MySQL Cluster Configuration
provide more in-depth
information on a variety of clustering options and co ......

PHP新的连接MySQL方法mysqli

PHP新的连接MySQL方法mysqli
1. 开启PHP的API支持
(1)首先修改您的php.ini的配置文件。
      查找下面的语句:
      ;extension=php_mysqli.dll
      将其修改为:
      extension=php_mysqli.dll
......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号