问题没有听太明白,把SQL Server嵌入C???

解决方案 »

  1.   

    http://expert.csdn.net/Expert/topic/1113/1113817.xml?temp=.450268
      

  2.   

    main()
    {
    exec sql include sqlca
    exec sql begin declare section
      char prname[20];
      char productno[8];exec sql end declare sectionprintf("Input producno:");
    scanf("%s",&producno);exec sql select prname
             from product
             where productno=:productno
             into :prname;printf("Productname: %s\n",prname);exit();}  注意sql语句中调用c的变量前要加: 
    用exec sql来表示将执行sql语句
      

  3.   

    怎么编译阿,放在vc里编译一大堆错误,在sql server2000里也不行。
      

  4.   

    VC中开发环境的配置
    To add the needed directory names to Visual C++ environment settings On the Tools menu, click Options.
    Click the Directories tab.
    In the Show directories for box, click Include files.
    Enter the path for Microsoft® SQL Server™ 2000 development include files, typically x:\Program Files\Microsoft SQL Server\80\Tools\DevTools\Include.
    In the Show directories for box, click Library files.
    Enter the path for SQL Server development library files, typically x:\Program Files\Microsoft SQL Server\80\Tools\DevTools\Include.
    In the Show directories for box, click Executable files.
    Enter the path for SQL Server development binary executable files, typically C:\Program Files\Microsoft SQL Server\80\Tools\Binn. 
      

  5.   

    As you create each ESQL/C source file, you must indicate the preprocessor steps necessary to generate the appropriate C source for compilation. Depending on the version of Visual C++, use the Build menu or the Project menu to locate the compilation settings for the project.Compilation settings can be set at the source-file level, and the custom build steps for your ESQL/C source files are set at this level as well.To add custom build steps for an ESQL/C source file On either the Project menu (Visual C++ 5.0) or the Build menu (Visual C++ 4.x), click Settings. 
    Click the ESQL/C source file in the project's file list. In Visual C++ 5.0 a single instance of the file appears in the project's list. You can click All configurations in the Settings for box to set custom build commands for both debug and release versions of your project. In Visual C++ 4.x, you can expand the file list and select each occurrence of the ESQL/C source file to set the custom build commands for all project configurations.
    Click the Custom Build tab.
    In the Build commands box, enter the nsqlprep command. You can use the $(InputName) macro to specify the file.
    In the Output file(s) box, specify the name of the output file. The output file is a C source file. You can use the $(InputName) macro to specify the file. 
      

  6.   

    首先谢谢各位
    我按照enhydraboy(乱舞的浮尘) 的方法配置好后,运行 大力给出的程序
    能够build成功
    --------------------Configuration: testsql - Win32 Debug--------------------testsql.exe - 0 error(s), 0 warning(s)
    但是不能运行,因为根本没有生成exe文件。不知道为什么,请指教另:enhydraboy(乱舞的浮尘)
    Enter the path for Microsoft® SQL Server™ 2000 development include files, typically x:\Program Files\Microsoft SQL Server\80\Tools\DevTools\Include.
    In the Show directories for box, click Library files.
    Enter the path for SQL Server development library files, typically x:\Program Files\Microsoft SQL Server\80\Tools\DevTools\Include //这里因该是x:\Program Files\Microsoft SQL Server\80\Tools\DevTools\lib