当前位置: 技术问答>java相关
请各位高手指点一下该怎么作?(在线等待)
来源: 互联网 发布时间:2015-04-13
本文导语: import java.io.*; import java.sql.*; import javax.servlet.*; import javax.servlet.http.*; public class FwxxQuery extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException,IOException { String sql="select * fr...
import java.io.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class FwxxQuery extends HttpServlet
{
public void doGet(HttpServletRequest req,
HttpServletResponse res)
throws ServletException,IOException
{
String sql="select * from accept";
Connection con=null;
Statement statement=null;
ResultSet rs=null;
String a1;
res.setContentType("text/html");
ServletOutputStream sos=res.getOutputStream();
PrintWriter out =new PrintWriter(sos,true);
try
{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
con= DriverManager.getConnection("jdbc:microsoft:sqlserver://192.168.0.128:1433;DatabaseName=infomation","sa","123");
statement =con.createStatement();
rs=statement.executeQuery(sql);
ResultSetMetaData rsmd=rs.getMetaData();
int colCount =rsmd.getColumnCount();
String a1=rs.getString("SORT");(就是这一句在出错,屏蔽掉这一句就没有问题了,我看出来哪错了,请各位大侠不吝赐教)
}
}
}
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class FwxxQuery extends HttpServlet
{
public void doGet(HttpServletRequest req,
HttpServletResponse res)
throws ServletException,IOException
{
String sql="select * from accept";
Connection con=null;
Statement statement=null;
ResultSet rs=null;
String a1;
res.setContentType("text/html");
ServletOutputStream sos=res.getOutputStream();
PrintWriter out =new PrintWriter(sos,true);
try
{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
con= DriverManager.getConnection("jdbc:microsoft:sqlserver://192.168.0.128:1433;DatabaseName=infomation","sa","123");
statement =con.createStatement();
rs=statement.executeQuery(sql);
ResultSetMetaData rsmd=rs.getMetaData();
int colCount =rsmd.getColumnCount();
String a1=rs.getString("SORT");(就是这一句在出错,屏蔽掉这一句就没有问题了,我看出来哪错了,请各位大侠不吝赐教)
}
}
}
|
to delfa(雨天):
哥们,我到哪里领啊?
^^
哥们,我到哪里领啊?
^^