Data Binding Issues

S

Swagener

Hi all, I can't seem to get rid of this error whatever I do to have a
successful connection:
``````````````````````````````````````````````````````````````````````````````````
Explorer Error:
Server Error in '/' Application
DataBinding: 'System.Data.Common.DbDataRecord' does not contain a
property with the name 'Id'.
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace
below.
````````````````````````````````````````````````````````````````````````
Aspx File:
<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:SqlDataSource
ID="SqlDataSource1"
runat="server"
DataSourceMode="DataReader"
ConnectionString="<%$ ConnectionStrings:Surveyslol %>"
SelectCommand="SELECT DvName, DvcodeNo FROM DivisionName">
</asp:SqlDataSource>
<asp:GridView
ID="GridView1"
runat="server"
AutoGenerateColumns="True"
DataKeyNames="Id"
DataSourceID="SqlDataSource1">
</asp:GridView>
</div>
</form>
</body>
</html>
```````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Web.Config:
<?xml version="1.0"?>
<configuration>
<appSettings/>
<connectionStrings>
<add name="Surveyslol" connectionString="Data Source=.
\SQLSERVER;Initial Catalog=Surveys;Integrated Security=SSPI;"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<compilation debug="true"/>
<authentication mode="Forms"/>
</system.web>
</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

Similar Threads

Data binding issues 1
Treeview and Sitemap issues 0
Jquery click checkbox 0
repeater 0
Why is the border on top much wider 0
Gridview not updating data 1
Opener 0
Style sheet question 3

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top