我想把这个页面中涉及的asp改写成jsp,有追加 20
http://www.w3school.com.cn/ajax/ajax_database.asp...
http://www.w3school.com.cn/ajax/ajax_database.asp
展开
3个回答
展开全部
<%
try{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
String url="jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=数据库名称";
Connection conn = DriverManager.getConnection(url,"数据库用户名","密码");
Statement stmt = conn.createStatement();
sql="SELECT * FROM CUSTOMERS WHERE CUSTOMERID="
sql=sql & "'" & request.querystring("q") & "'"
ResultSet rs = stmt.executeQuery(sql);
while(rs.next()) {
%>
<%=rs.getString(1)%>
<%=rs.getString(2)%>
<%
}}
%>
try{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
String url="jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=数据库名称";
Connection conn = DriverManager.getConnection(url,"数据库用户名","密码");
Statement stmt = conn.createStatement();
sql="SELECT * FROM CUSTOMERS WHERE CUSTOMERID="
sql=sql & "'" & request.querystring("q") & "'"
ResultSet rs = stmt.executeQuery(sql);
while(rs.next()) {
%>
<%=rs.getString(1)%>
<%=rs.getString(2)%>
<%
}}
%>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询