在C#.net程序中使用MYSQL数据库
下面是commond:
MySQLCommand cmd;
cmd = new MySQLDriverCS.MySQLCommand("DROP TABLE IF EXISTS test.mysqldrivercs_test",conn);
cmd.ExecuteNonQuery();
cmd.Dispose();
下面是insert:
string Value = "Value";
int SettingID = 1;
new MySQLInsertCommand(conn,
new object[,] {{"SettingID",SettingID},{"SettingValue",Value}},
"mysqldrivercs_test");
下面是update
Value = "Value2";
new MySQLUpdateCommand(conn,
new object[,] {{"SettingValue",Value}},
"mysqldrivercs_test",
new object[,] {{"SettingID","=",SettingID}},
null);
下面是select
DataTable dt = new MySQLSelectCommand(conn,
new string[] {"SettingID","SettingValue"},
new string[] {"mysqldrivercs_test"},
new object[,] {{"SettingID","=",SettingID}},
null,
null
).Table;
string storedValue = dt.Rows[0]["SettingValue"].ToString();
下面是delete
new MySQLDeleteCommand(conn,"mysqldrivercs_test",new object[,] {{"SettingID","=",SettingID}},null);
关闭链接:
conn.Close();
相关文档:
TIMESTAMP列类型提供一种类型,你可以使用它自动地用当前的日期和时间标记INSERT或UPDATE的操作。如果你有多个TIMESTAMP列,只有第一个自动更新。
自动更新第一个TIMESTAMP列在下列任何条件下发生:
列没有明确地在一个INSERT或LOAD DATA INFILE语句中指定。
列没有明确地在� ......
【前提】
winxpsp3
mysql5.1
【步骤】
1.进入MySQL Command Line Client;
2.命令:
mysql> show variables like 'character%';
+--------------------------+---------------------------------------------------------+
| Variable_name | ......
1、在linux下:
查看mysql 是否运行:ps -ef | grep myslq
如果 MySQL 正在运行,首先杀之: kill mysql的进程号。
启动 MySQL :/usr/bin/safe_mysqld --skip-grant-tables &
就可以不需要密码就进入 MySQL 了。
然后就是
>use mysql
......
12.8. Cast函数和操作符
BINARY
BINARY操作符将后面的字符串抛给一个二进制字符串。这是一种简单的方式来促使逐字节而不是逐字符的进行列比较。这使得比较区分大小写,即使该列不被定义为 BINARY或 BLOB。BINARY也会产生结尾空白,从而更加显 ......
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;
&nb ......