性能测试脚本之SQLServer执行语句
生活随笔
收集整理的這篇文章主要介紹了
性能测试脚本之SQLServer执行语句
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
實(shí)例如下:
工具:SQLServer2008,Loadrunner12
協(xié)議:ODBC協(xié)議
注意事項(xiàng):
執(zhí)行腳本之前需要開啟所有的遠(yuǎn)程服務(wù)才能成功連接數(shù)據(jù)庫(kù)
遠(yuǎn)程服務(wù)文檔如下:
http://jingyan.baidu.com/article/6c67b1d6ca06f02787bb1ed1.html
?
Action() {int NumRows=0;int i=1;int NumRows1=0;//建立數(shù)據(jù)庫(kù)連接lr_db_connect("StepName=DatabaseConnection","ConnectionString=Password=XX0817xx@@@;Persist Security Info=True;User ID=sa;Initial Catalog=student;Data Source=ESFVMVI-2528\\SQLEXPRESS","ConnectionName=InvDatabaseConnection","ConnectionType=SQL",LAST);//執(zhí)行SQL語(yǔ)句NumRows=lr_db_executeSQLStatement("StepName=PerformQuery","ConnectionName=InvDatabaseConnection","SQLStatement=SELECT * FROM score","DatasetName=MyDataset",LAST);lr_output_message("The query returned %d rows.", NumRows);//打印出結(jié)果lr_db_dataset_action("StepName=PrintDataset","DatasetName=MyDataset","Action=PRINT",LAST);NumRows1=lr_db_executeSQLStatement("StepName=procQuery","ConnectionName=InvDatabaseConnection","SQLStatement=exec StuProc1","DatasetName=MyDataset1",LAST);lr_output_message("The query returned %d rows.", NumRows1);lr_db_dataset_action("StepName=PrintDataset","DatasetName=MyDataset1","Action=PRINT",LAST);lr_db_disconnect("StepName=Disconnect","ConnectionName=InvDatabaseConnection", LAST ); }?
轉(zhuǎn)載于:https://www.cnblogs.com/TingJie/p/6410917.html
總結(jié)
以上是生活随笔為你收集整理的性能测试脚本之SQLServer执行语句的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: MVC传递Model
- 下一篇: VC连接access