VC连接数据库难题---强人进!

zoehugh 2006-03-21 10:58:14
现有个系统用ADO连接VC6.0,采用的数据库是ACCESS.现在要把它改成ODBC连接VC6.0.采用的数据库是MYSQL.哪位强人能搞定呀?
看看你的数据库知识的真本领!
...全文
210 9 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
一条晚起的虫 2006-03-22
  • 打赏
  • 举报
回复
MySQL和Access的SQL也可能有一些不同,毕竟大家都有一些扩展SQL语句
zblaoshu1979 2006-03-21
  • 打赏
  • 举报
回复
呵呵,还是听楼上的大哥说的自己找找例子看吧。
快乐鹦鹉 2006-03-21
  • 打赏
  • 举报
回复
就是ODBC连接MYSQL数据库的问题阿。说ADO的废话干啥。网上现成的连接方式都有,自己找找就行了。
podded 2006-03-21
  • 打赏
  • 举报
回复
表需要对字段的类型修改,因为两种数据库还是有些差异的
如果都是用的标准SQL,那就不用修改语句
连接方式就按上面说的去查
程序中应该还是要有改动的,字段的类型有可能有变动
此外,ODBC连接还是要多写不少底层的代码,ADO封装了OLE DB
zoehugh 2006-03-21
  • 打赏
  • 举报
回复
我的意思是把之前的ACCESS数据库改成MYSQL。而ACCESS是用ADO的。MYSQL是要用ODBCD的。怎样把数据库改成MYSQL呢?怎样连接呢?除了修改连接之外,还要修改别的地方吗?如数据库语句等。
robin_yao 2006-03-21
  • 打赏
  • 举报
回复
ODBC Driver for MySQL

If you want to connect to a local database you can use a connection string like the following:

strConnect = _T("Driver={MySQL ODBC 3.51 Driver};Server=localhost;"
"Database=MyDatabase;User=MyUserName;Password=MyPassword;Option=4;");
If you want to connect with a remote database, You need to specify the Name of server or IP in the Server parameter. If the Port is distinct to 3306 (default port) you must to specify it.

strConnect = _T("Driver={mySQL ODBC 3.51 Driver};Server=MyRemoteHost;"
"Port=3306;Option=4;Database=MyDatabase;Uid=MyUsername;Pwd=MyPassword;");
The parameter Option can be one or more of the following values

1 The client can't handle that MyODBC returns the real width of a column.
2 The client can't handle that MySQL returns the true value of affected rows. If this flag is set then MySQL returns 'found rows' instead. One must have MySQL 3.21.14 or newer to get this to work.
4 Make a debug log in c:\myodbc.log. This is the same as putting MYSQL_DEBUG=d:t:O,c::\myodbc.log in `AUTOEXEC.BAT'
8 Don't set any packet limit for results and parameters.
16 Don't prompt for questions even if driver would like to prompt
32 Enable or disable the dynamic cursor support. This is not allowed in MyODBC 2.50.
64 Ignore use of database name in 'database.table.column'.
128 Force use of ODBC manager cursors (experimental).
256 Disable the use of extended fetch (experimental).
512 Pad CHAR fields to full column length.
1024 SQLDescribeCol() will return fully qualified column names.
2048 Use the compressed server/client protocol
4096 Tell server to ignore space after function name and before '(' (needed by PowerBuilder). This will make all function names keywords!
8192 Connect with named pipes to a mysqld server running on NT.
16384 Change LONGLONG columns to INT columns (some applications can't handle LONGLONG).
32768 Return 'user' as Table_qualifier and Table_owner from SQLTables (experimental)
65536 Read parameters from the client and odbc groups from `my.cnf'
131072 Add some extra safety checks (should not bee needed but...)
If you want to have many options, you should add the above flags! For example: 16 + 1024 = 1030 and use Option= 1030;
robin_yao 2006-03-21
  • 打赏
  • 举报
回复
http://topic.csdn.net/t/20050125/13/3752257.html
robin_yao 2006-03-21
  • 打赏
  • 举报
回复
http://dev.csdn.net/article/44/44930.shtm
handsomerun 2006-03-21
  • 打赏
  • 举报
回复
哈哈,鸟人就是鸟人啊,看问题一针见血啊

http://www.vckbase.com/document/listdoc.asp?mclsid=11&sclsid=1101
去那看看资料吧

4,018

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 数据库
社区管理员
  • 数据库
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧