Hi folks,
For some reason, the following simple code will not produce any results although there are 2 rows in the database. Not even an error. I've tried like 30 different connectstrings. The IIS web server and the SQL Express SQL Server are both on the same PC. Could you please look at it and give me some ideas?
TIA, DanielInTenn
---code---
<%@ Page Language="
VB" AutoEventWireup="false" CodeFile="Default.aspx.
vb" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Import Namespace="System.Data.OleDb" %>
<script runat="server">
sub Page_Load
Dim dbconn As OleDbConnection, sql As String, dbcomm As OleDbCommand, dbread As OleDbDataReader
dbconn = New OleDbConnection("Driver={SQL SERVER};Data Source=DANIEL-PC\SQLEXPRESS;Initial Catalog=Nicecars;UID=cars;PWD=mustang")
dbconn.Open()
sql = "select * from cars order by CaridNo "
dbcomm = New OleDbCommand(sql, dbconn)
dbread = dbcomm.ExecuteReader()
cars.DataSource = dbread
cars.DataBind()
dbread.Close()
dbconn.Close()
end sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Browse Automobiles</title>
</head>
<body>
<form id="carform" runat="server">
<asp:Repeater ID="cars" runat="server">
<HeaderTemplate>
<table border="1" width="100%">
<tr>
<th>Year</th>
<th>New or Used</th>
<th>Make</th>
<th>Model</th>
<th>Mileage</th>
<th>Color</th>
<th>Details</th>
<th>Price ($)</th>
<th>Body Style</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td><%#Container.DataItem("Year").GetType%></td>
<td><%#Container.DataItem("Year")%></td>
<td><%#IIf(Container.DataItem("IsNew"), "New", "Used")%></td>
<td><%#Container.DataItem("Make")%></td>
<td><%#Container.DataItem("Model")%></td>
<td><%#Container.DataItem("Mileage")%></td>
<td><%#Container.DataItem("Color")%></td>
<td><%#Container.DataItem("Details")%></td>
<td><%#Format(Container.DataItem("Price"), "$###,###")%></td>
<td><%#Container.DataItem("BodyStyle")%></td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
</form>
</body>
</html>