文档详情

vb数据库连接字符串.doc

发布:2017-06-11约1.14万字共9页下载文档
文本预览下载声明
************************************************************************* ? ? ** ? ? ** ? 使用 ? adodb.stream ? 保存/读取文件到数据库 ? ? ** ? 引用 ? microsoft ? activex ? data ? objects ? 2.5 ? library ? 及以上版本 ? ? ** ? ? ** ? ----- ? 数据库连接字符串模板 ? --------------------------------------- ? ? ** ? access数据库 ? ? ** ? iconcstr ? = ? provider=microsoft.jet.oledb.4.0;persist ? security ? info=false ? ? _ ? ? ** ? ? ? ? ? ;data ? source=数据库名 ? ? ** ? ? ** ? sql数据库 ? ? ** ? iconcstr ? = ? provider=sqloledb.1;persist ? security ? info=true; ? ? _ ? ? ** ? ? ? ? ? user ? id=用户名;password=密码;initial ? catalog=数据库名;data ? source=sql服务器名 ? ? ** ? ? ************************************************************************* ? ? ? ? 保存文件到数据库中 ? ? sub ? s_savefile() ? ? ? ? ? ? dim ? istm ? as ? adodb.stream ? ? ? ? ? ? dim ? ire ? as ? adodb.recordset ? ? ? ? ? ? dim ? iconcstr ? as ? string ? ? ? ? ? ? ? ? ? ? ? ? 数据库连接字符串 ? ? ? ? ? ? iconcstr ? = ? provider=microsoft.jet.oledb.4.0;persist ? security ? info=false ? ? _ ? ? ? ? ? ? ? ? ? ? ;data ? source=f:/my ? documents/客户资料1.mdb ? ? ? ? ? ? ? ? ? ? ? ? 读取文件到内容 ? ? ? ? ? ? set ? istm ? = ? new ? adodb.stream ? ? ? ? ? ? with ? istm ? ? ? ? ? ? ? ? ? ? .type ? = ? adtypebinary ? ? ? ? 二进制模式 ? ? ? ? ? ? ? ? ? ? .open ? ? ? ? ? ? ? ? ? ? .loadfromfile ? c:/test.doc ? ? ? ? ? ? end ? with ? ? ? ? ? ? ? ? ? ? ? ? 打开保存文件的表 ? ? ? ? ? ? set ? ire ? = ? new ? adodb.recordset ? ? ? ? ? ? with ? ire ? ? ? ? ? ? ? ? ? ? .open ? 表, ? iconc, ? adopenkeyset, ? adlockoptimistic ? ? ? ? ? ? ? ? ? ? .addnew ? ? ? ? ? ? ? ? ? 新增一条记录 ? ? ? ? ? ? ? ? ? ? .fields(保存文件内容的字段) ? = ? istm.read ? ? ? ? ? ? ? ? ? ? .update ? ? ? ? ? ? end ? with ? ? ? ? ? ? ? ? ? ? ? ? 完成后关闭对象 ? ? ? ? ? ? ire.close ? ? ? ? ? ? istm.close ? ? end ? sub ? ? ? ? 从数据库中读取数据,保存成文件 ? ? sub ? s_readfile() ? ? ? ? ? ? dim ? istm ? as ? adodb.stream ? ? ? ? ? ? dim ? ire ? as ? adodb.recordset ? ? ? ? ? ? dim ? iconc ? as ? string ? ? ? ? ? ? ?
显示全部
相似文档