欢迎来到天天文库
浏览记录
ID:48062670
大小:293.01 KB
页数:13页
时间:2020-01-13
《在VC++6.0中嵌入sql的方法[1].ppt》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、在C中嵌入sql的方法操作环境,基于:Vc++6.0sqlserver2000杜茂康2004-10-2InstallingEmbeddedSQLforCDirectoryFileDescriptionMssql7BinnNsqlprep.exe32-bitprecompilerforMicrosoft®WindowsNT®4.0,MicrosoftWindows®95,andWindows98Sqlaiw32.dllPrecompilerservicesforWindowsNT4.0,Windows95,andWindows98Sqlakw32.dllRun-ti
2、meservicesforWindowsNT4.0, Windows95,andWindows98Mssql7DevToolsIncludeSqlca.hSQLCAheaderSqlda.hSQLDAheaderMssql7DevToolsLibCaw32.libSQLCAlibraryforWindowsNT4.0,Windows95,andWindows98Sqlakw32.libRun-timeservicesimportlibraryforWindowsNT4.0,Windows95,andWindows98Mssql7DevToolsSam
3、plesEsqlc*.*CsamplesMssql7DevToolsLibNtwdblib.libDB-LibraryusedforcommunicatingwithSQLServer.ThisispartofDB-Librarydevelopmenttools.VC中嵌入SqlServer2000数据库访问的SQL的C程序要访问的SQLServer库文件、动态链接库、头文件及执行文件源文件:simple.sqcC嵌入SQL步骤之一:建立源文件建立嵌入了SQL的C源程序注意文件的扩展名为.sqc在VC环境中输入的嵌入了SQL的源程序#include4、f.h>#includeintmain(intargc,char**argv,char**envp){EXECSQLBEGINDECLARESECTION;charserver[]="CQUPT-DK.pubs";charuser[]="sa.1";charfirst_name[50];charlast_name[]="white";EXECSQLENDDECLARESECTION;EXECSQLSETOPTIONLOGINTIME10;EXECSQLSETOPTIONQUERYTIME100;EXECSQLCONNECTTO:serverUSER:5、user;EXECSQLSELECTau_fnameINTO:first_namefromauthorswhereau_lname=:last_name;printf("%s",first_name);EXECSQLDISCONNECTALL;}C嵌入SQL步骤之二:设置预编译环境设置SQL.sqc的预编译环境选择VC的“tools”|“options”菜单项.ClicktheDirectoriestab.IntheShowdirectoriesforbox,clickIncludefiles.EnterthepathforMicrosoft®SQ6、LServer™2000developmentincludefiles,typicallyx:ProgramFilesMicrosoftSQLServer80ToolsDevToolsInclude.C嵌入SQL步骤之二:设置预编译环境IntheShowdirectoriesforbox,click:Libraryfiles.EnterthepathforSQLServerdevelopmentlibraryfiles,typicallyx:ProgramFilesMicrosoftSQLServer80ToolsDevToolsInclude7、.C嵌入SQL步骤之二:设置预编译环境IntheShowdirectoriesforbox,clickExecutablefiles.EnterthepathforSQLServerdevelopmentbinaryexecutablefiles,typicallyC:ProgramFilesMicrosoftSQLServer80ToolsBinn7、8两步主要指定嵌入SQL预编译器nsqlprep.EXE文件所在的磁盘位置。此文件由sqlserver提供,在安装SQLServer可能不会被安装,所以要将此文件从SQLServer安装盘拷
4、f.h>#includeintmain(intargc,char**argv,char**envp){EXECSQLBEGINDECLARESECTION;charserver[]="CQUPT-DK.pubs";charuser[]="sa.1";charfirst_name[50];charlast_name[]="white";EXECSQLENDDECLARESECTION;EXECSQLSETOPTIONLOGINTIME10;EXECSQLSETOPTIONQUERYTIME100;EXECSQLCONNECTTO:serverUSER:
5、user;EXECSQLSELECTau_fnameINTO:first_namefromauthorswhereau_lname=:last_name;printf("%s",first_name);EXECSQLDISCONNECTALL;}C嵌入SQL步骤之二:设置预编译环境设置SQL.sqc的预编译环境选择VC的“tools”|“options”菜单项.ClicktheDirectoriestab.IntheShowdirectoriesforbox,clickIncludefiles.EnterthepathforMicrosoft®SQ
6、LServer™2000developmentincludefiles,typicallyx:ProgramFilesMicrosoftSQLServer80ToolsDevToolsInclude.C嵌入SQL步骤之二:设置预编译环境IntheShowdirectoriesforbox,click:Libraryfiles.EnterthepathforSQLServerdevelopmentlibraryfiles,typicallyx:ProgramFilesMicrosoftSQLServer80ToolsDevToolsInclude
7、.C嵌入SQL步骤之二:设置预编译环境IntheShowdirectoriesforbox,clickExecutablefiles.EnterthepathforSQLServerdevelopmentbinaryexecutablefiles,typicallyC:ProgramFilesMicrosoftSQLServer80ToolsBinn7、8两步主要指定嵌入SQL预编译器nsqlprep.EXE文件所在的磁盘位置。此文件由sqlserver提供,在安装SQLServer可能不会被安装,所以要将此文件从SQLServer安装盘拷
此文档下载收益归作者所有