导航:
论坛 -> DELPHI技术
斑竹:liumazi,sephil
作者:
2003/10/29 8:27:28
标题:
如何在数据库中设置一个字段让他关联一个文件
浏览:2736
加入我的收藏
楼主:
如何在数据库中设置一个字段让他关联一个文件 比如说关联一个文本文件,当在数据库中找到该记录时, 能弹出相应的一个文本文件来
----------------------------------------------
尽情舒展,是一种向往,想去的地方、想拥有的感受,尽管追求!
作者:
bios (阿贡)
★☆☆☆☆
-
盒子中级会员
2003/10/29 11:09:34
1楼:
就是个 文本类型 里面存 c:\a.txt table1->first(): while !(table1->eof()) {String s= table1->fieldby("myinfo")->asString; if (s==yourfindstr) { String path=table1->fieldby("path")->asString; winexec("explorer path",cmdshownormal); } table1->next(); }
----------------------------------------------
作者:
2003/10/29 20:19:34
2楼:
String path=table1->fieldby("path")->asString; 上句中,两个Path是一样的吗,怎么用啊,好像没用上啊 explorer path是什么,浏览器的路径吗
----------------------------------------------
尽情舒展,是一种向往,想去的地方、想拥有的感受,尽管追求!
作者:
bios (阿贡)
★☆☆☆☆
-
盒子中级会员
2003/10/29 20:41:12
3楼:
String path=table1->fieldby("yourpath")->asString; winexec("explorer.exe path",cmdshownormal); winexec 是执行命令的API函数 表示用 explorer 来打开路径 如explorer.exe c:\path2 要不用这个也可以 ShellExecute(application->handle,"open",path.c_str(), NULL,NULL,SW_SHOWNORMAL ) HINSTANCE ShellExecute( HWND hwnd, // handle to parent window LPCTSTR lpOperation, // pointer to string that specifies operation to perform LPCTSTR lpFile, // pointer to filename or folder name string LPCTSTR lpParameters, // pointer to string that specifies executable-file parameters LPCTSTR lpDirectory, // pointer to string that specifies default directory INT nShowCmd // whether file is shown when opened );
----------------------------------------------
作者:
2003/10/29 21:23:58
4楼:
编译提示cmdshownormal没有申明,什么问题
----------------------------------------------
尽情舒展,是一种向往,想去的地方、想拥有的感受,尽管追求!
作者:
2003/10/29 21:37:43
5楼:
编译提示shellExecute也没有申明啊
----------------------------------------------
尽情舒展,是一种向往,想去的地方、想拥有的感受,尽管追求!
作者:
zizii (高高高级馒头)
★☆☆☆☆
-
神秘会员
2003/10/29 22:28:02
6楼:
shellExecute在ShellAPI单元; uses ShellAPI;
----------------------------------------------
维护世界和平,共创美好盒子。
作者:
2003/10/30 7:58:56
7楼:
shellExecute函数中的参数可以去哪些值呢,可以系统一点吗
----------------------------------------------
尽情舒展,是一种向往,想去的地方、想拥有的感受,尽管追求!
作者:
2003/10/30 8:22:19
8楼:
path.c_str()有问题,这项参数该怎么填
----------------------------------------------
尽情舒展,是一种向往,想去的地方、想拥有的感受,尽管追求!
作者:
2003/10/30 9:00:33
9楼:
7楼问题可以参考联机帮助
----------------------------------------------
尽情舒展,是一种向往,想去的地方、想拥有的感受,尽管追求!
作者:
2003/10/30 10:08:20
10楼:
如果Path填上具体的路径,就可以打开,如下 winexec('explorer c:\my documents\Text.txt',SW_SHOWNORMAL); 可是我想用一个变量比如说就Path吧 winexec('explorer path',SW_SHOWNORMAL); 他就只是打开c:\目录,而不执行path路径 如何解决
----------------------------------------------
尽情舒展,是一种向往,想去的地方、想拥有的感受,尽管追求!
作者:
2003/10/30 11:14:41
11楼:
shellExecute(handle,'open',Path,NULL,NULL,sw_SHOWNORMAL); 编译提示NULL那类型不匹配
----------------------------------------------
尽情舒展,是一种向往,想去的地方、想拥有的感受,尽管追求!
作者:
bios (阿贡)
★☆☆☆☆
-
盒子中级会员
2003/10/30 11:39:21
12楼:
我是用 C++写的 uses shellapi; shellExecute(handle,'open',Path,nil,nil,sw_SHOWNORMAL);//DELPHI打开文件 explorer.exe 只负责打开 目录
----------------------------------------------
作者:
2003/10/30 14:29:05
13楼:
12楼,改成nil也还是一样的编译提示,说是不匹配的string或pchar
----------------------------------------------
尽情舒展,是一种向往,想去的地方、想拥有的感受,尽管追求!
作者:
bios (阿贡)
★☆☆☆☆
-
盒子中级会员
2003/10/30 14:42:36
14楼:
shellExecute(handle,'open',pchar(Path),nil,nil,sw_SHOWNORMAL);
----------------------------------------------
作者:
2003/10/30 16:14:16
15楼:
14楼,这样问题就解决了 10楼那个问题如何解决呢? 难道用winexec就没法实现吗,
----------------------------------------------
尽情舒展,是一种向往,想去的地方、想拥有的感受,尽管追求!