What is wrong with the data binding?

B

Ben L

I'm just following along with the video tutorials on the asp.net website. I'm
data binding a to datagrid using the northwind.mdf file. I run a test query
in the query builder and everything is fine, I see the correct results.
Then I 'open in browser' to see the results, and the data grid never
appears.
I even make the query set to show everything, and I get nothing.

But if I just drag in the table with no query, I do see the results in the
web browser.
What am I doing wrong?

Thanks,
Ben.
 
B

Ben L

</head>
<body>
<form id="form1" runat="server" method="post">
<div>
<h2 align="center">
View Your orders</h2>
<p id="P1">



<asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="False" DataSourceID="SqlDataSource1"
EmptyDataText="There are no data records to display.">
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:NORTHWNDConnectionString1 %>"
ProviderName="<%$
ConnectionStrings:NORTHWNDConnectionString1.ProviderName %>"
SelectCommand="SELECT [OrderID], [CustomerID], [EmployeeID],
[OrderDate], [Freight], [ShippedDate] FROM [Orders]">
</asp:SqlDataSource>
</p>

</div>
</form>
</body>
</html>


and in web.config

<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<connectionStrings>
<add name="ASPNETDBConnectionString1" connectionString="Data
Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated
Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
<add name="NORTHWNDConnectionString1" connectionString="Data
Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\NORTHWND.MDF;Integrated
Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<compilation debug="true" />
<authentication mode="Forms" />
</system.web>
<system.net>
<mailSettings>
<smtp from="ASPWEBBY">
<network host="smtp.msn.com" password="aaa" userName="human"
/>
</smtp>
</mailSettings>
</system.net>
</configuration>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top