VS2005中,access对只读目录的属性判断不准确
只读目录,
C:\>attrib +A +S +H +R testdir
C:\>attrib testdir
A SHR C:\testdir
(1)VC6.0的执行结果:
***********test stat***********************
file [c:\testdir] exists!
file [c:\testdir] is directory!
file [c:\testdir] can be read!
file [c:\testdir] can not be writed!
***********test access***********************
file [c:\testdir] exists!
file [c:\testdir] can not be writed!
file [c:\testdir] can be read!
(2)VS2005的执行结果
***********test stat***********************
file [c:\testdir] exists!
file [c:\testdir] is directory!
file [c:\testdir] can be read!
file [c:\testdir] can not be writed!
***********test access***********************
file [c:\testdir] exists!
file [c:\testdir] can be writed!
file [c:\testdir] can be read!
结论:在VS2005中,使用access判断的只读目录却有【写入】的属性。
有什么高招,欢迎解答。
建议,在VS2005中对文件、目录进行权限校验时,最好不要用access。
#include <stdio.h>
#include <windows.h>
#include <stdio.h>
#include <io.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
int main(int argc ,char *argv[])
{
struct stat buf;
int ret = 0;
int i=0;
char *file = "c:\\testdir";
printf("***********test stat***********************\n");
ret = stat(file, &buf );
if(ret != 0)
{
printf("stat [%s] fail, errno=%d\n", file, errno);
return -1;
}
else
printf("file [%s] exists!\n", file);
if((buf.st_mode&S_IFDIR)==0)
printf("file [%s] is not directory!\n", file);
else
printf("file [%s] is directory!\n", file);
if((buf.st_mode&S_IREAD)!=0)
printf("file [%s] can be read!\n", file);
else
printf("file [%s] can not be read!\n", file);
if((buf.st_mode&S_IWRITE)!=0)
printf("file [%s] can be writed!\n", file);
else
printf("file [%s
相关文档:
新建表:
create table [表名]
(
[自动编号字段] int IDENTITY (1,1) PRIMARY KEY ,
[字段1] nVarChar(50) default '默认值' null ,
[字段2] ntext null ,
[字段3] datetime,
[字段4] money null ,
[字段5] int default 0,
[字段6] Decimal (12,4) default 0,
[字段7] image null ,
)
删除表:
Drop table [表 ......
sqlserver:update Table_A set Table_A.col1 = (select Table_B.col1 from Table_B where Table_A.col2 = Table_B.col2)
Access: UPDATE Table_ A, Table_B SET Table_ A.字段2 = Table_ B.字段2
WHERE Table_ A.编号=Table_ A.编号;
自己记下,提醒自己 ......
public static DataTable GetSchemaTable(string connectionString) //获取Access所有的表名;
{
using (OleDbConnection connection = new
&n ......
在SQL Server中模糊查询通常是这样的Select * from articleTable where authorName like '%jacky%'
但是在Access中用这条语句执行的时候竟然发现查不出结果,怎么可能呢?
后来查了下资料,发现问题如下:
要进行模糊查找,则必须使用通配符,ACCESS库的通配符和SQL SERVER的通配符不一样。
ACCESS库的通配符为:
*& ......
今天,还是在做那个项目,依然使用往常的sqlhelper用法,往常的数据库操作类,但是偏偏调试不成功,而且最重要的是,它不报错
中午吃饭回来,本来想打算睡个午觉的,但是项目太紧迫了,于是又跟车车研究了一中午,最后,发现如果不用@参数传递的话,是正常运行的,于是百度了一下,那些人说要用“?”当占位符
......