1 connection con=new connection(); 2 statement stm=con.createStatement(); 3 ResultSET R; 4 str 1024 strSql; 5 ; 6 7 strSql = 'select top 10 * from inventTable '; 8 R = stm.executeQuery(strSQL); 9 while(r.next()) 10 { 11 print r.getString(1); 12 }
//调用存储过程:
//strsql='Execute SP \''+A+'\',\''+B+'\',\''+C+'\''+',\''+D+'\'';//A,B,C,D为动态传过去额参数。
//stm.executeUpdate(strsql);//执行,注意函数和执行select的不一样。