Delphi2007中使用DbExpress连接MySql的例子
来源:互联网 发布:php session 时间设置 编辑:程序博客网 时间:2024/05/08 02:57
新建数据库
/**//*
MySQL Data Transfer
Source Host: localhost
Source Database: blog
Target Host: localhost
Target Database: blog
Date: 2008/04/15 16:18:41
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for posts
-- ----------------------------
CREATE TABLE `posts` (
`id` int(10) unsigned NOT NULL auto_increment,
`title` varchar(50) default NULL,
`body` text,
`created` datetime default NULL,
`modified` datetime default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records
-- ----------------------------
INSERT INTO `posts` VALUES ('1', 'The title', 'This is the post body.', '2008-04-08 11:51:46', null);
INSERT INTO `posts` VALUES ('2', 'A title once again', 'And the post body follows.', '2008-04-08 11:51:46', null);
INSERT INTO `posts` VALUES ('3', 'Title strikes back', 'This is really exciting! Not.', '2008-04-08 11:51:46', null);
MySQL Data Transfer
Source Host: localhost
Source Database: blog
Target Host: localhost
Target Database: blog
Date: 2008/04/15 16:18:41
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for posts
-- ----------------------------
CREATE TABLE `posts` (
`id` int(10) unsigned NOT NULL auto_increment,
`title` varchar(50) default NULL,
`body` text,
`created` datetime default NULL,
`modified` datetime default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records
-- ----------------------------
INSERT INTO `posts` VALUES ('1', 'The title', 'This is the post body.', '2008-04-08 11:51:46', null);
INSERT INTO `posts` VALUES ('2', 'A title once again', 'And the post body follows.', '2008-04-08 11:51:46', null);
INSERT INTO `posts` VALUES ('3', 'Title strikes back', 'This is really exciting! Not.', '2008-04-08 11:51:46', null);
Delphi2007中新建工程,页面上追加TSimpleDataSet及TDataSource控件。
然后做如下设置
字段直接可以拉到页面上的,如下:
设置各个控件间的DataSource属性。后台代码:
使用 DbExpress 的时候总感觉很别扭。网上也有很多人说这套组件有潜在BUG存在。不知道是不是真的有李维大师所说的那样好。
注意:关于事务:使用StartTransaction方法的话需要用到TTransactionDesc类,这需要在开头uses部追加SqlExpr。
如果换成BeginTransaction方法的话需要用到TDBXTransaction类,这需要在开头uses部追加DBXCommon。
从警告信息可以判断,Delphi2007已经开始不推荐使用StartTransaction方法做事务处理了。
- Delphi2007中使用DbExpress连接MySql的例子
- Delphi XE中使用dbExpress连接MySQL数据库疑难问题解决
- XE7 Datasnap使用dbExpress连接MySQL数据库
- [Delphi]Delphi中dbexpress连接3.0以上高版本mysql的问题
- Delphi2009中使用dbExpress组件访问MySql(登陆页面)
- 关于C++Builder 2007使用dbexpress + mysql的一些问题
- dbexpress在程序设计中自动连接数据库
- 使用dbExpress方式连接Oracle数据库
- 使用dbExpress连接方式访问数据库
- delphi xe 之路(27)XE7 Datasnap使用dbExpress连接MySQL
- Delphi XE8中的DBExpress使用ODBC方式连接MySQL 5.6.24 X64!!!!
- Java中连接MySql数据库的例子
- 用dbExpress连接数据库的一点记录
- 给 DBExpress 增加 Firebird 连接的方法
- 给DBExpress增加Firebird连接的方法
- dbExpress的upWhereKeyOnly的使用注意事项
- 解决delphi2007下dbexpress连mysql5时中文显示乱码(文中有可连非默认端口的方法)
- Hibernate4使用Annotation连接访问MySQL的小例子
- 关于PHP你可能不知道的-PHP的事件驱动化设计
- 技巧(5)- 如何将Grid型的datawindow改成Tabular型的
- 害怕别人乱输数据吗?提高你的数据校验功能-AJAX输入校验(8)
- 如何删除detached instance?
- 运用C#创建一个.Net下的Web Service
- Delphi2007中使用DbExpress连接MySql的例子
- 析构函数
- 认识了解WMV 9 视频编解码器
- 使用 Word 2007 和 Visual Basic 2005 自动创建数据丰富的业务文档
- c#多线程的奥妙
- 唐骏跳槽到福建民企新华都 出任总裁一职
- CreateRemoteThread远程注入 使用例子
- [Asp.Net]GridView中根据前后列之间的关联关系合并单元格
- Google调整蜘蛛功能 企业网面临危险