sprintf(szSqlText,"select ID,name,sex,age,score_cp,score_en,score_math,(score_cp+score_en+score_math)/3 score_avg from tbl_student order by");百度了一下“”里面的内容不都是%d之类的数据类型吗?这个是什么意思呢?另外还求大佬科普一下select from order by的shi'yong
1条回答 默认 最新
- threenewbee 2019-04-22 00:09关注
这个是拼接sql字符串,下面肯定有数据库的操作。sprintf类似printf可以有参数,也可以没有参数。
好比printf既可以写printf("a = %d", a);也可以写printf("hello world");后者就没有参数
这里也是一样的。你可以认为 sprintf(szsqltext, "select id, name, ...");相当于strcpy(szsqltext, "select id, name, ...");
至于sql怎么用,这个不是几句话能说清楚的,看这里
http://www.w3school.com.cn/sql/index.asp本回答被题主选为最佳回答 , 对您是否有帮助呢?解决评论 打赏 举报无用 1