Category: ASP

Connect To SQL Express

<%@ page import="java.sql.*" %>
<% String connectionUrl = "jdbc:sqlserver://localhostSQLEXPRESS;databaseName=[database;"; Connection connection = null; Statement statement = null; ResultSet rs = null; %>

<%
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance();
connection = DriverManager.getConnection(connectionUrl, "[username", "[password");
statement = connection.createStatement();
rs = statement.executeQuery("SELECT [field FROM [table");

while (rs.next()) {
out.println(rs.getString("[field")+"
");
}

rs.close();
%>


JSP

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.