使用自定义的类CSetODBC(二)
来源:互联网 发布:java编程基础学校 编辑:程序博客网 时间:2024/05/21 09:51
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
1,利用SQL词句理论上可以使用任何数据库,以sql为例.body.clientHeight)this.width=body.clientHeight" src="http://www.338888.com/VCShare/images/upfile/200461521239.jpg" onmousewheel="return yuzi_img(event,this)"> 2,使用方法void CTestODBCDlg::OnUseSql() {CSetODBC dlg;dlg.SetFileName( "f:/setodbc.con");dlg.SetAppName("test");const CString strConnect = dlg.GetConnectStr();//获得连接串CString strSQL;CDatabase db;db.OpenEx(strConnect);//打开数据库{//追加记录strSQL = "insert into character(Name,Country,Age) values('he','china',24)";db.ExecuteSQL(strSQL);}{//删除记录strSQL.Format("delete from character where Age = %d",24);db.ExecuteSQL(strSQL);}{//修改记录strSQL.Format("update character set age = 25 where name = 'he'");db.ExecuteSQL(strSQL);}//显示所有记录{CString strOutPut ;CRecordset rs(&db);rs.Open(CRecordset::snapshot,"select * from character");int nField = rs.GetODBCFieldCount();while(!rs.IsEOF()){for(int i = 0 ; i < nField ; i++){CString strTemp;rs.GetFieldValue((short)i,strTemp);strTemp.TrimLeft();strTemp.TrimRight();strOutPut +=(strTemp + '');}strOutPut += "";rs.MoveNext();}rs.Close();AfxMessageBox(strOutPut);}db.Close();}3,相关信息记录在f:/setodbc.con,其内容为:[test]DSN=testodbc_sql UID=saPWD=4,如果用户想重新设置ODBC,则:void CTestODBCDlg::OnResetOdbc() {CSetODBC dlg;dlg.SetFileName( "f:/setodbc.con");dlg.SetAppName("test");const CString strConnect = dlg.GetConnectStr(true);//重新设置ODBC}<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script><script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
- 使用自定义的类CSetODBC(二)
- 使用自定义的类CSetODBC(二)
- 使用自定义的类CSetODBC(一)
- 使用自定义的类CSetODBC (2)
- 使用自定义的类CSetODBC (3)
- 使用自定义的类CSetODBC(一)
- 设置ODBC的自定义类CSetODBC
- 设置ODBC的自定义类CSetODBC (1)
- 自定义使用Adapter的组件(二)
- android:自定义View的使用(二)
- 自定义组件(二)------使用系统控件组合的自定义控件
- 自定义组件(二)------使用系统控件组合的自定义控件之二
- 创建一个简单的web服务器(二):使用自定义的类加载器来替换URLClassLoader
- 自定义控件的使用二----DBGlobal.cs部分
- JSP中自定义标记库的使用(二)
- 使用AVPlayer自定义支持全屏的播放器(二)
- iOS phoneGap的使用(二、自定义phoneGap插件)
- Vtune 使用二 (自定义Configuration)
- mcv模式中的留言板
- 使用自定义的类CSetODBC(一)
- 访问ADO
- .net的一些观点
- ez_setup.py for 0.6c8 (网上下载)
- 使用自定义的类CSetODBC(二)
- 的一点经验
- 在VC中使用Automation操纵Word和Excel
- ez_setup.py for 0.6c1 (同事李林)
- 的一些构想(从需求到数据库设计)
- 如何在MDI客户区窗口响应鼠标双击消息?
- 学习笔记(三)
- NT Service的几个注意点和示例代码
- 超越SOA:动态业务应用的新企业应用框架