sprintf(sqls,"dasi_insert %d,'%s %d:%d',%d,%d",vid,buf,hour,minu,ival,fread(&hour,1,1,fp);fread(&minu,1,1,fp);fread(&ival,2,1,fp);fread(&flags,2,1,fp);sprintf(sqls,"%sdasi_insert %d,'%s %d:%d',%d,%d",hisdb,vid,buf,hour,minu,ival,flags);SQLExecDirect(

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/23 15:19:02
sprintf(sqls,"dasi_insert%d,''%s%d:%d'',%d,%d",vid,buf,hour,minu,ival,fread(&hour,1,1,fp);fread(&minu,

sprintf(sqls,"dasi_insert %d,'%s %d:%d',%d,%d",vid,buf,hour,minu,ival,fread(&hour,1,1,fp);fread(&minu,1,1,fp);fread(&ival,2,1,fp);fread(&flags,2,1,fp);sprintf(sqls,"%sdasi_insert %d,'%s %d:%d',%d,%d",hisdb,vid,buf,hour,minu,ival,flags);SQLExecDirect(
sprintf(sqls,"dasi_insert %d,'%s %d:%d',%d,%d",vid,buf,hour,minu,ival,
fread(&hour,1,1,fp);
fread(&minu,1,1,fp);
fread(&ival,2,1,fp);
fread(&flags,2,1,fp);
sprintf(sqls,"%sdasi_insert %d,'%s %d:%d',%d,%d",hisdb,vid,buf,hour,minu,ival,flags);
SQLExecDirect(hstmt,(BYTE*)sqls,SQL_NTS);
SQLFreeStmt(hstmt,SQL_CLOSE);

sprintf(sqls,"dasi_insert %d,'%s %d:%d',%d,%d",vid,buf,hour,minu,ival,fread(&hour,1,1,fp);fread(&minu,1,1,fp);fread(&ival,2,1,fp);fread(&flags,2,1,fp);sprintf(sqls,"%sdasi_insert %d,'%s %d:%d',%d,%d",hisdb,vid,buf,hour,minu,ival,flags);SQLExecDirect(
这个是ODBC API操作数据库的一组语句.
sprintf(sqls,"%sdasi_insert %d,'%s %d:%d',%d,%d",hisdb,vid,buf,hour,minu,ival,flags);
这个是格式化sqls的操作,将后面的参数hisdb,vid,buf,hour,minu,ival,flagsf分别格式化%sdasi_insert %d,'%s %d:%d',%d,%d中,buf,hour,minu对应的是'%s %d:%d'里面的.
SQLExecDirect(hstmt,(BYTE*)sqls,SQL_NTS); //这个是执行sql语句
SQLFreeStmt(hstmt,SQL_CLOSE); //这个是释放sql句柄.
ODBC API你可以晚上搜一下,有很多示例的.微软官网msdn上面也有API的具体用法.这样的资料很多的,你一看就知道了.