资源描述:
《c语言sybase数据库编程》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、c语言sybase数据库编程应用并不是十分广泛,但是对于有些特殊的应用还是一种很基本的编程方法。但是关于这方面的应用书籍和网上谈论的并不是很多,下面使我做得一个评价系统的程序中一小段,仅供参考:DBPROCESS*dbproc,*dbproc1,*dbproc2; LOGINREC*login; RETCODEreturn_code; STATUSre_code; inti,k,m,me; intch; DBCHARhhs[5]; DBCHARjghs[5]; DBCHARczys[5]
2、; DBCHARczyxms[11]; DBINThmycs; DBINTjbmycs; DBINTbmycs; DBINTwpjcs; floatfhmycs; floatfjbmycs; floatfbmycs; floatfwpjcs; floatjbmzb; floatbmyzb; floathmyzb; floatwpjzb; charhh[5]; charjgh[5]; charjgmc[31]; charqtbz[2]; charyy; charpjrq[9]; charyear
3、9[5]; charmonth9[3]; charday9[3]; intzcs; chardydate[80]; chardysql[255];zy1: initscr(); win=newwin(22,80,0,0); main_scr(win); mvwaddstr(win,6,22," "); mvwaddstr(win,4,26,"★☆某日评价菜单☆★"); mvwaddstr(win,
4、6,20,"请输入日期:[ ]"); mvwaddstr(win,14,26," "); mvwaddstr(win,11,20,"是否正确(y/n):[]"); mvwscanw(win,6,32,"%s",pjrq); sscanf(pjrq,"%4s%2s%2s",year9,month9,day9); ch=mvwgetch(win,11,35); if(ch=='y'){gotozy2;}
5、elsegotozyx;zy2: if(isalnum(pjrq[0])==0
6、
7、strlen(pjrq)!=8) { mvwaddstr(win,16,20,"输入错!!!请等........"); wrefresh(win); beep(); sleep(3); gotozy1; } login=dblogin(); dbsetifile("interfaces"); DBSETLUSER(login,"pjqsa"); DBSETLPWD(login,"pjqsadb
8、o"); dbproc2=dbopen(login,NULL); dbproc=dbopen(login,NULL); dbproc1=dbopen(login,NULL); dbfcmd(dbproc2,"deletefromt_rytjls"); dbsqlexec(dbproc2); dbresults(dbproc2); dbclose(dbproc2); dbfcmd(dbproc,"selecthh,jgh,czy,czyxm,hmycs,
9、jbmycs,bmycs,wpjcsfromt_mrtjwheregzrq='%s'",pjrq); dbsqlexec(dbproc); while((return_code=dbresults(dbproc))!=NO_MORE_RESULTS) { if(return_code==SUCCEED) { dbbind(dbproc,1,NTBSTRINGBIND,(DBINT)0,(BYTE*)&hhs); dbbind(dbproc,2,NTBSTRINGBIN
10、D,(DBINT)0,(BYTE*)&jghs); dbbind(dbproc,3,NTBSTRINGBIND,(DBINT)0,(BYTE*)&czys); dbbind(dbproc,4,NTBSTRINGBIND,(DBINT)0,(BYTE*)&czyxms); dbbind(dbproc,5,INTBIND,(DBINT)0,(BYTE*)&hmycs); dbbind(dbproc,6,INTBIND