51Testing软件测试论坛
标题:
数据库操作的样例脚本
[打印本页]
作者:
fish_yy
时间:
2006-3-10 15:52
标题:
数据库操作的样例脚本
db_connect("query1","DSN=test;uid=admin;pwd=");
val=db_execute_query("query1","select * from school ",row_nb);
if (val==0) {
print(" query record num="&row_nb);
db_get_headers ("query1",field_num,headers);
print("headers-count: "&field_num&" headcontent "&headers);
for (i=0;i<row_nb;i++){
db_get_row("query1",i,row_content);
abc=db_get_field_value("query1","#"&i&"\"","#1");
print(abc);
obj_type("Edit",""&abc&"");
}
}
##读取当前数据表 第1行第2个字段的内容
aaa =db_get_field_value("query1","#0","#1");## #0实际上就是第一行记录
print("DNAME="&aaa);
##插入记录到数据库中
db_execute_query("query1","insert into school values (66,'地质大学2','城府路3号')",i);
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2