各位大虾,这是我在编写VC++数据库编程中出现的问题,不知那位大虾,能给小的一些意见,指导指导,谢谢!为什么我在程序中用预编译指令#import,程序会出错,这个提示是什么问题?怎么改?illegal escape sequence什么意思?
//
//通过在程序中使用预编译指令#import来告诉编译器
//将此指令中指定的动态链接库引入工程中,
//并从动态链接库中取出其中的对象和信息,
//产生msado15.tlh和ado15.tli两个头文件来定义ADO库
//
#import "c:\program files\common files\system\ado\msado15.dll" \
no_namespace \
rename ("EOF", "adoEOF")--------------------Configuration: YDMS - Win32 Debug--------------------
Compiling...
StdAfx.cpp
d:\ydms\stdafx.h(29) : error C2017: illegal escape sequence
d:\ydms\debug\msado15.tlh(405) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
Error executing cl.exe.YDMS.exe - 1 error(s), 1 warning(s)

解决方案 »

  1.   

    你不把它们分行写,写在同一行试试看.....#import "c:\program files\common files\system\ado\msado15.dll" no_namespace rename("EOF","adoEOF")
      

  2.   

    #import 语句放在include的后面
      

  3.   

    把这个语句放在StdAfx.h的最后就没问题了吧
      

  4.   

    TO:jayfunk(crazydog),把什么语句放在StdAfx.h的最后? 
    #import "c:\program files\common files\system\ado\msado15.dll" \
    no_namespace \
    rename ("EOF", "adoEOF")
    在就是写在StdAfx.h里的。
      

  5.   

    你到这个目录下去看看,有没有这个文件。如果有的话,你把它Copy到你现在程序所在的目录,再加入#import "msado15.dll" \
    rename( "EOF", "adoEOF" ) no_namespace rename("DataTypeEnum", "adoDataTypeEnum")
    试试!
      

  6.   

    TO:clack234(Byron) 哪个目录??
      

  7.   

    盘符一般为你安装VC得盘1.stdafx.h中加入
    #import "C:\Program Files\Common Files\System\ado\msado15.dll" no_namespace rename("EOF","adoEOF") 
    2。app文件的InitInstance中加入
    if(S_OK!=OleInitialize(NULL))
    {
    AfxMessageBox("初始化COM组件库错误");
    }
    下面就是数据库操作
    _ConnectionPtr pConn;
    _RecordsetPtr  pRs;
    CString strSQL;
    pConn.CreateInstance(__uuidof(Connection));
    pConn->CursorLocation=adUseClient;
    strSQL="Provider=SQLOLEDB;Server=Gooyan;DataBase=SkillsBox;UID=sa;PWD=aaaaaaaa";
    pConn->Open(_bstr_t(strSQL),"","",-1);

    pRs.CreateInstance(__uuidof(Recordset));
    pRs->CursorLocation=adUseClient;
    pRs->PutActiveConnection(pConn.GetInterfacePtr());

    pRs1.CreateInstance(__uuidof(Recordset));
    pRs1->CursorLocation=adUseClient;
    pRs1->PutActiveConnection(pConn.GetInterfacePtr()); strSQL="select * from catalog order by cataid";
    pRs->Open(_bstr_t(strSQL),vtMissing,adOpenDynamic,adLockBatchOptimistic,adCmdText);
      

  8.   

    把#import "c:\program files\common files\system\ado\msado15.dll" no_namespace rename("EOF","adoEOF")
    放到Stdafx.h文件中