Question : DataBinding: 'System.Data.Common.DataRecordInternal' does not contain a property with the name 'IdKeuze'.

Hello all,

I'm fairly new to this programming stuff so please bear with me.
On my page (overzichtpnnr.aspx) there's a searchbox that fills the gridview.
When one click's on the 'details' of the gridview a detailview should open up and it's there that i get the following error --> DataBinding: 'System.Data.Common.DataRecordInternal' does not contain a property with the name 'IdKeuze'.
In the 'detailsview' there is a DropDownList which is populated by a table (tblKeuzelijst) from an accessdb (dbVerzuim) if it's empty and when someone all ready made a choise it's filled up with the result from another table (tblVerzuim) from the same database. I think the problem lies with the properties of the DropDownList because when i change it to a TextBox it fills up with the result from tblVerzuim.

Here is the code from the aspx page.

 
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
<%@ Page Language="VB" MasterPageFile="~/MasterControle.master" AutoEventWireup="false"
    CodeFile="overzichtpnnr.aspx.vb" Inherits="overzichtpnnr" Title="Verzuim Limburg - Beheerders Menu - Overzicht op P-nr" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <ajaxToolkit:ToolkitScriptManager runat="Server" EnableScriptGlobalization="true"
        EnableScriptLocalization="true" ID="ScriptManager1" />
    <span style="font-size: 16pt; color: #3300cc; font-family: Arial"><strong>Beheerders:
        Overzicht actieve ziekteperiodes op personeelsnummer</strong></span><br />
    <br />
    <table>
        <tr>
            <td style="width: 100px">
                <asp:Label ID="Label1" runat="server" Text="Personeelsnummer"></asp:Label>
            </td>
            <td style="width: 100px">
                <asp:TextBox ID="txtpnnrzoek" runat="server"></asp:TextBox>
            </td>
            <td style="width: 100px">
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtpnnrzoek"
                    ErrorMessage="U moet een geldig personeelsnummer ingeven">*</asp:RequiredFieldValidator>
                <asp:CompareValidator ID="CompareValidator5" runat="server" ControlToValidate="txtpnnrzoek"
                    ErrorMessage="U moet een geldig personeelsnummer ingeven" Operator="DataTypeCheck"
                    Type="Double">*</asp:CompareValidator>
            </td>
        </tr>
        <tr>
            <td style="width: 100px">
            </td>
            <td style="width: 100px">
                <asp:Button ID="btnzoek" runat="server" Text="Zoek" />
            </td>
            <td style="width: 100px">
            </td>
        </tr>
        <tr>
            <td style="width: 100px">
            </td>
            <td style="width: 100px">
                <asp:Button ID="btnexcel" runat="server" Text="exporteer nr excel" Visible="False" />
            </td>
            <td style="width: 100px">
            </td>
        </tr>
    </table>
    &nbsp;<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False"
        CellPadding="4" ForeColor="#333333" GridLines="None" Height="50px" Width="500px">
        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <CommandRowStyle BackColor="#D1DDF1" Font-Bold="True" />
        <RowStyle BackColor="#EFF3FB" />
        <FieldHeaderStyle BackColor="#DEE8F5" Font-Bold="True" />
        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
        <Fields>
            <asp:TemplateField HeaderText="Personeelsnummer">
                <ItemTemplate>
                    <asp:Label ID="Label8" runat="server" Text='<%# Eval("pnnr") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Datum ziekte van">
                <ItemTemplate>
                    <asp:TextBox ID="txtdatumvan" runat="server" Text='<%# eval("datumvan", "{0:d}") %>'></asp:TextBox>
                    <asp:ImageButton runat="Server" ID="Image1" ImageUrl="~/images/Calendar_scheduleHS.png"
                        AlternateText="Klik hier om de kalender te tonen" />
                    <ajaxToolkit:CalendarExtender ID="calendarButtonExtender1" runat="server" TargetControlID="txtdatumvan"
                        PopupButtonID="Image1" TodaysDateFormat="d MMMM yyyy" />
                    <asp:RequiredFieldValidator ID="RFtxtdatumvan" runat="server" ControlToValidate="txtdatumvan"
                        ErrorMessage="U moet een datum invullen">*</asp:RequiredFieldValidator>
                    <asp:CompareValidator ID="CVtxtdatumvan" runat="server" ControlToValidate="txtdatumvan"
                        ErrorMessage="U moet een geldige datum ingeven" Operator="DataTypeCheck" Type="Date">*</asp:CompareValidator>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Datum ziekte tot">
                <ItemTemplate>
                    <asp:TextBox ID="txtdatumtot" runat="server" Text='<%# eval("datumtot", "{0:d}") %>'></asp:TextBox>
                    <asp:ImageButton runat="Server" ID="Image2" ImageUrl="~/images/Calendar_scheduleHS.png"
                        AlternateText="Klik hier om de kalender te tonen" />
                    <ajaxToolkit:CalendarExtender ID="calendarButtonExtender2" runat="server" TargetControlID="txtdatumtot"
                        PopupButtonID="Image2" TodaysDateFormat="d MMMM yyyy" />
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtdatumvan"
                        ErrorMessage="U moet een datum invullen">*</asp:RequiredFieldValidator>
                    <asp:CompareValidator ID="CompareValidator1" runat="server" ControlToValidate="txtdatumtot"
                        ErrorMessage="U moet een geldige datum ingeven" Operator="DataTypeCheck" Type="Date">*</asp:CompareValidator>
                    <asp:CompareValidator ID="CompareValidator4" runat="server" ControlToCompare="txtdatumvan"
                        ControlToValidate="txtdatumtot" ErrorMessage="De einddatum kan niet voor de startdatum liggen."
                        Operator="GreaterThanEqual" Type="Date">*</asp:CompareValidator>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Datum ziekteattest">
                <ItemTemplate>
                    <asp:TextBox ID="txtdatumziekteattest" runat="server" Text='<%# eval("datumziekteattest", "{0:d}") %>'></asp:TextBox>
                    <asp:ImageButton runat="Server" ID="Image3" ImageUrl="~/images/Calendar_scheduleHS.png"
                        AlternateText="Klik hier om de kalender te tonen" />
                    <ajaxToolkit:CalendarExtender ID="calendarButtonExtender3" runat="server" TargetControlID="txtdatumziekteattest"
                        PopupButtonID="Image3" TodaysDateFormat="d MMMM yyyy" />
                    <asp:CompareValidator ID="CompareValidator2" runat="server" ControlToValidate="txtdatumziekteattest"
                        ErrorMessage="U moet een geldige datum ingeven. Indien deze niet gekend is geef dan 1/1/3000 in."
                        Operator="DataTypeCheck" Type="Date">*</asp:CompareValidator>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="txtdatumziekteattest"
                        ErrorMessage="U moet een datum invullen. Indien deze niet gekend is geef dan 1/1/3000 in.">*</asp:RequiredFieldValidator>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Controle/datum">
                <ItemTemplate>
                    <asp:CheckBox ID="slkcontrole" runat="server" Checked='<%# eval("controle") %>' />
                    <asp:TextBox ID="txtcontrole" runat="server" Text='<%# eval("datumcontrole", "{0:d}") %>'></asp:TextBox>
                    <asp:ImageButton runat="Server" ID="Image4" ImageUrl="~/images/Calendar_scheduleHS.png"
                        AlternateText="Klik hier om de kalender te tonen" />
                    <ajaxToolkit:CalendarExtender ID="calendarButtonExtender4" runat="server" TargetControlID="txtcontrole"
                        PopupButtonID="Image4" TodaysDateFormat="d MMMM yyyy" />
                    <asp:CompareValidator ID="CompareValidator3" runat="server" ControlToValidate="txtcontrole"
                        ErrorMessage="U moet een geldige datum ingeven. Indien deze niet gekend is geef dan 1/1/3000 in."
                        Operator="DataTypeCheck" Type="Date">*</asp:CompareValidator>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="txtcontrole"
                        ErrorMessage="U moet een datum invullen. Indien deze niet gekend is geef dan 1/1/3000 in.">*</asp:RequiredFieldValidator>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Resultaat controle">
                <ItemTemplate>
                    <asp:TextBox ID="txtresultaat" runat="server" Text='<%# eval("resultaatcontrole") %>'>
                    </asp:TextBox>
                    <asp:DropDownList ID="drpResultaatControle" runat="server" SelectedValue='<%# eval("IdKeuze") %>' DatavalueField="IdKeuze" DataTextField="keuzemogelijkheden">
                    </asp:DropDownList>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Annulatie controle">
                <ItemTemplate>
                    <asp:CheckBox ID="slkcontroleannulatie" runat="server" Checked='<%# eval("controleannulatie") %>'
                        Enabled="False" Visible='<%# eval("controleannulatie") %>' />
                    <asp:Button ID="btnannulatiecontrole" runat="server" OnClick="btnannulatiecontrole_Click"
                        Text="controle annuleren" Visible='<%# not eval("controleannulatie") %>' />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Opmerkingen">
                <ItemTemplate>
                    <asp:TextBox ID="txtopmerkingen" runat="server" Text='<%# eval("opmerkingen") %>'
                        TextMode="MultiLine" Width="230px"></asp:TextBox>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Ingegeven">
                <ItemTemplate>
                    <asp:Label ID="Label6" runat="server" Text='<%# "door " &  eval("useringave") & " op " & eval("datumingave") %>'
                        Width="298px"></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Gewijzigd">
                <ItemTemplate>
                    <asp:Label ID="Label7" runat="server" Text='<%# "door " & eval("usergewijzigd") & " op " & eval("datumgewijzigd") %>'
                        Width="295px"></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Controle geannuleerd">
                <ItemTemplate>
                    <asp:Label ID="Label9" runat="server" Text='<%# "door " & eval("userannulatiecontrole") & " op " & eval("datumannulatiecontrole") %>'
                        Width="297px"></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Gewist">
                <ItemTemplate>
                    <asp:Label ID="Label10" runat="server" Text='<%# "door " & eval("userwissen") & " op " & eval("datumwissen") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <ItemTemplate>
                    <asp:Button ID="btnOpslaan" runat="server" OnClick="btnOpslaan_Click" Text="Opslaan" />
                    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;
                    <asp:Button ID="btnWissen" runat="server" OnClick="btnWissen_Click" Text="Wissen" />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="id" Visible="False">
                <ItemTemplate>
                    <asp:Label ID="lblID" runat="server" Text='<%# eval("Id") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
        </Fields>
        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <EditRowStyle BackColor="#2461BF" />
        <AlternatingRowStyle BackColor="White" />
    </asp:DetailsView>
    <asp:Label ID="lblok" runat="server" Font-Bold="True" ForeColor="#CC0000" Text="De gegevens werden correct opgeslaan, klik op Zoek om de pagina opnieuw in te laden."
        Visible="False" Width="695px"></asp:Label><br />
    <asp:ValidationSummary ID="ValidationSummary1" runat="server" Width="702px" />
    <br />
    <asp:GridView ID="dgOverzicht" runat="server" AutoGenerateColumns="False" CellPadding="4"
        ForeColor="#333333" GridLines="None" EnableModelValidation="True">
        <RowStyle BackColor="#EFF3FB" />
        <Columns>
            <asp:CommandField EditText="edit" SelectText="Details" ShowSelectButton="True" />
            <asp:TemplateField HeaderText="Personeelslid">
                <ItemTemplate>
                    <asp:Label ID="lblpnnr" runat="server" Text='<%# EVAL("Naam") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Datum van">
                <ItemTemplate>
                    <asp:Label ID="lbldatumvan" runat="server" Text='<%# Eval("datumvan", "{0:d}") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Datum tot">
                <ItemTemplate>
                    <asp:Label ID="lbldatumtot" runat="server" Text='<%# Eval("datumtot",  "{0:d}") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Datum ziekteattest">
                <ItemTemplate>
                    <asp:Label ID="lbldatumziekteattest" runat="server" Text='<%# Eval("datumziekteattest",  "{0:d}") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Controle">
                <ItemTemplate>
                    <asp:CheckBox ID="slkcontrole" runat="server" Checked='<%# Eval("controle") %>' Enabled="False" />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Datum controle">
                <ItemTemplate>
                    <asp:Label ID="lbldatumcontrole" runat="server" Text='<%# Eval("datumcontrole",  "{0:d}") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Resultaat controle">
                <ItemTemplate>
                    <asp:Label ID="lblresultaatcontrole" runat="server" Text='<%# Eval("resultaatcontrole") %>'> </asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Controle geannuleerd">
                <ItemTemplate>
                    <asp:CheckBox ID="slkcontroleannulatie" runat="server" Checked='<%# Eval("controleannulatie") %>'
                        Enabled="False" />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Opmerkingen">
                <ItemTemplate>
                    &nbsp;<asp:TextBox ID="txtopmerkingen" runat="server" ReadOnly="True" Text='<%# eval("opmerkingen") %>'
                        TextMode="MultiLine" Width="219px"></asp:TextBox>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="ID" Visible="False">
                <ItemTemplate>
                    <asp:Label ID="lblID" runat="server" Text='<%# Eval("ID") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <EditRowStyle BackColor="#2461BF" />
        <AlternatingRowStyle BackColor="White" />
    </asp:GridView>
</asp:Content>


And here is the code from the vb file

 
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
274:
275:
Imports System.Data.OleDb

Partial Class overzichtpnnr
    Inherits System.Web.UI.Page

    Protected Sub Btnzoek_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnzoek.Click


        Dim strverzuim As String = System.Configuration.ConfigurationManager.ConnectionStrings("DBverzuimCS").ConnectionString
        Dim conn As New OleDbConnection(strverzuim)
        Dim cm As New OleDbCommand
        cm.CommandText = "SELECT tblverzuim.Id, tblverzuim.datumvan, tblverzuim.datumtot, tblverzuim.datumziekteattest, [IGPNNR] & ' ' & RTrim([IGVRNM]) & ' ' & RTrim([IGNAAM]) AS Naam, tblverzuim.controle, tblverzuim.datumcontrole, tblverzuim.controleannulatie, tblverzuim.opmerkingen, tblverzuim.datumingave, tblverzuim.resultaatcontrole" _
                        & " FROM tblPersoneelAS400 INNER JOIN tblverzuim ON tblPersoneelAS400.IGPNNR = tblverzuim.pnnr" _
                        & " WHERE tblPersoneelAS400.IGPNNR=? AND tblverzuim.wissen=False" _
                        & " GROUP BY tblverzuim.Id, tblverzuim.datumvan, tblverzuim.datumtot, tblverzuim.datumziekteattest, [IGPNNR] & ' ' & RTrim([IGVRNM]) & ' ' & RTrim([IGNAAM]), tblverzuim.controle, tblverzuim.datumcontrole, tblverzuim.controleannulatie, tblverzuim.opmerkingen, tblverzuim.datumingave, tblverzuim.resultaatcontrole" _
                        & " ORDER BY tblverzuim.datumvan DESC , tblverzuim.datumtot DESC;"
        Dim p2 As New OleDbParameter
        p2.ParameterName = "pnnr"
        p2.OleDbType = OleDbType.Double
        p2.Value = Me.txtpnnrzoek.Text

        cm.Connection = conn
        cm.Connection.Open()
        cm.Parameters.Add(p2)
        Me.dgOverzicht.DataSource = cm.ExecuteReader()
        Me.dgOverzicht.DataBind()

        Me.lblok.Visible = False
        Me.btnexcel.Visible = True

        cm.Connection.Close()
        cm.Parameters.Clear()


    End Sub

    ''Kleur de rijen die vandaag gemaakt zijn groen & rijen die vandaag verlopen zijn rood. Hier word geselecteerd op Kolom "datumingave" uit de Tabel "tblVerzuim" van dbVerzuim
    Protected Sub dgOverzicht_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles dgOverzicht.RowDataBound
        If e.Row.RowType = DataControlRowType.DataRow Then
            Dim groen As String = DataBinder.Eval(e.Row.DataItem, "datumingave")
            Dim rood As String = DataBinder.Eval(e.Row.DataItem, "datumtot")
            If groen = Today Then
                e.Row.ForeColor = Drawing.Color.Green
            End If
            If rood = Today Then
                e.Row.ForeColor = Drawing.Color.Red
            End If
        End If
    End Sub

    Public Sub dgOverzicht_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles dgOverzicht.SelectedIndexChanged

        Dim strverzuim As String = System.Configuration.ConfigurationManager.ConnectionStrings("DBverzuimCS").ConnectionString
        Dim conn As New OleDbConnection(strverzuim)
        Dim cm As New OleDbCommand
        cm.CommandText = "SELECT tblverzuim.datumvan, tblverzuim.datumtot, tblverzuim.datumziekteattest, tblverzuim.pnnr, tblverzuim.wissen, tblverzuim.opmerkingen, tblverzuim.Id, tblverzuim.controle, tblverzuim.datumcontrole, tblverzuim.controleannulatie, tblverzuim.useringave, tblverzuim.datumingave, tblverzuim.userannulatiecontrole, tblverzuim.datumannulatiecontrole, tblverzuim.userwissen, tblverzuim.datumwissen, tblverzuim.usergewijzigd, tblverzuim.datumgewijzigd, tblverzuim.resultaatcontrole" _
                        & " FROM tblverzuim" _
                        & " WHERE tblverzuim.Id=?;"

        Dim p1 As New OleDbParameter
        p1.ParameterName = "ID"
        p1.OleDbType = OleDbType.Double
        p1.Value = CType(Me.dgOverzicht.SelectedRow.FindControl("lblid"), Label).Text

        cm.Connection = conn
        cm.Connection.Open()
        cm.Parameters.Add(p1)
        Me.DetailsView1.DataSource = cm.ExecuteReader
        Me.DetailsView1.DataBind()

        cm.Connection.Close()
        cm.Parameters.Clear()

        ''hier vult de dropdownlist van Resultaat Controle zich mee op
        Dim ctrl As Control
        ctrl = DetailsView1.FindControl("drpResultaatControle")
        If Not ctrl Is Nothing Then
            Dim mylistbox As DropDownList = DirectCast(ctrl, DropDownList)
            If Not mylistbox Is Nothing Then
                ' prepare the SQl query
                Dim sqlCmd As String = "SELECT tblkeuzelijst.IdKeuze, tblKeuzelijst.keuzemogelijkheden FROM tblKeuzelijst"

                VulListbox(mylistbox, sqlCmd)
            End If
        End If

    End Sub

    Private Sub VulListbox(ByVal lstObj As DropDownList, ByVal sqlCmd As String)

        Dim p1 As New OleDbParameter
        Dim strverzuim As String = System.Configuration.ConfigurationManager.ConnectionStrings("DBverzuimCS").ConnectionString
        Dim conn As New OleDbConnection(strverzuim)
        Dim cm As New OleDbCommand
        cm.CommandText = sqlCmd
        cm.Connection = conn
        cm.Connection.Open()

        lstObj.DataSource = cm.ExecuteReader()
        lstObj.DataValueField = "IdKeuze"
        lstObj.DataTextField = "keuzemogelijkheden"
        lstObj.DataBind()

        'sluit af
        cm.Connection.Close()
        cm.Parameters.Clear()

    End Sub

    Protected Sub btnOpslaan_Click(ByVal sender As Object, ByVal e As System.EventArgs)

        Dim strverzuim As String = System.Configuration.ConfigurationManager.ConnectionStrings("DBverzuimCS").ConnectionString
        Dim conn As New OleDbConnection(strverzuim)
        Dim cm As New OleDbCommand
        cm.CommandText = "UPDATE tblverzuim SET tblverzuim.datumvan = ?, tblverzuim.datumtot = ?, tblverzuim.datumziekteattest =?, tblverzuim.opmerkingen = ?, tblverzuim.usergewijzigd = ?, tblverzuim.datumgewijzigd = ?, tblverzuim.controle=?, tblverzuim.datumcontrole=?, tblverzuim.resultaatcontrole=?" _
                        & " WHERE (((tblverzuim.Id)=?));"


        Dim p1, p2, p3, p4, p5, p6, p7, p8, p9, p10 As New OleDbParameter
        p1.ParameterName = "ID"
        p2.ParameterName = "datumvan"
        p3.ParameterName = "datumtot"
        p4.ParameterName = "datumattest"
        p5.ParameterName = "opmerkingen"
        p6.ParameterName = "usergewijzigd"
        p7.ParameterName = "datumgewijzigd"
        p8.ParameterName = "controlejanee"
        p9.ParameterName = "datumcontrole"
        p10.ParameterName = "resultaatcontrole"

        p1.OleDbType = OleDbType.Double
        p2.OleDbType = OleDbType.Date
        p3.OleDbType = OleDbType.Date
        p4.OleDbType = OleDbType.Date
        p5.OleDbType = OleDbType.Char
        p6.OleDbType = OleDbType.Char
        p7.OleDbType = OleDbType.Date
        p8.OleDbType = OleDbType.Boolean
        p9.OleDbType = OleDbType.Date
        p10.OleDbType = OleDbType.Char

        p1.Value = CType(Me.DetailsView1.FindControl("lblid"), Label).Text
        p2.Value = CType(Me.DetailsView1.FindControl("txtdatumvan"), TextBox).Text
        p3.Value = CType(Me.DetailsView1.FindControl("txtdatumtot"), TextBox).Text
        p4.Value = CType(Me.DetailsView1.FindControl("txtdatumziekteattest"), TextBox).Text
        p5.Value = CType(Me.DetailsView1.FindControl("txtopmerkingen"), TextBox).Text
        p6.Value = User.Identity.Name
        p7.Value = System.DateTime.Now
        p8.Value = CType(Me.DetailsView1.FindControl("slkcontrole"), CheckBox).Checked
        p9.Value = CType(Me.DetailsView1.FindControl("txtcontrole"), TextBox).Text
        p10.Value = CType(Me.DetailsView1.FindControl("drpResultaatControle"), DropDownList).SelectedValue


        cm.Connection = conn
        cm.Connection.Open()
        cm.Parameters.Add(p2)
        cm.Parameters.Add(p3)
        cm.Parameters.Add(p4)
        cm.Parameters.Add(p5)
        cm.Parameters.Add(p6)
        cm.Parameters.Add(p7)
        cm.Parameters.Add(p8)
        cm.Parameters.Add(p9)
        cm.Parameters.Add(p10)
        cm.Parameters.Add(p1)

        cm.ExecuteNonQuery()

        cm.Connection.Close()
        cm.Parameters.Clear()

        Me.lblok.Visible = True
        Me.DetailsView1.DataSource = Nothing
        Me.DetailsView1.DataBind()
        Me.dgOverzicht.DataSource = Nothing
        Me.dgOverzicht.DataBind()
    End Sub

    Protected Sub btnWissen_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim strverzuim As String = System.Configuration.ConfigurationManager.ConnectionStrings("DBverzuimCS").ConnectionString
        Dim conn As New OleDbConnection(strverzuim)
        Dim cm As New OleDbCommand
        cm.CommandText = "UPDATE tblverzuim SET tblverzuim.wissen = -1, tblverzuim.userwissen =?, tblverzuim.datumwissen = ?" _
                        & " WHERE (((tblverzuim.Id)=?));"
        Dim p1, p2, p3 As New OleDbParameter
        p1.ParameterName = "ID"
        p2.ParameterName = "userwissen"
        p3.ParameterName = "datumwissen"
        p2.OleDbType = OleDbType.Char
        p3.OleDbType = OleDbType.Date
        p1.OleDbType = OleDbType.Double
        p1.Value = CType(Me.DetailsView1.FindControl("lblid"), Label).Text
        p2.Value = User.Identity.Name
        p3.Value = System.DateTime.Now

        cm.Connection = conn
        cm.Connection.Open()
        cm.Parameters.Add(p2)
        cm.Parameters.Add(p3)
        cm.Parameters.Add(p1)
        cm.ExecuteNonQuery()
        cm.Connection.Close()
        cm.Parameters.Clear()

        Me.lblok.Visible = True
        Me.DetailsView1.DataSource = Nothing
        Me.DetailsView1.DataBind()
        Me.dgOverzicht.DataSource = Nothing
        Me.dgOverzicht.DataBind()
    End Sub

    Protected Sub btnannulatiecontrole_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim strverzuim As String = System.Configuration.ConfigurationManager.ConnectionStrings("DBverzuimCS").ConnectionString
        Dim conn As New OleDbConnection(strverzuim)
        Dim cm As New OleDbCommand
        cm.CommandText = "UPDATE tblverzuim SET tblverzuim.controleannulatie = -1, tblverzuim.userannulatiecontrole =?, tblverzuim.datumannulatiecontrole = ?" _
                        & " WHERE (((tblverzuim.Id)=?));"
        Dim p1, p2, p3 As New OleDbParameter
        p1.ParameterName = "ID"
        p2.ParameterName = "userwissen"
        p3.ParameterName = "datumwissen"
        p2.OleDbType = OleDbType.Char
        p3.OleDbType = OleDbType.Date
        p1.OleDbType = OleDbType.Double
        p1.Value = CType(Me.DetailsView1.FindControl("lblid"), Label).Text
        p2.Value = User.Identity.Name
        p3.Value = System.DateTime.Now

        cm.Connection = conn
        cm.Connection.Open()
        cm.Parameters.Add(p2)
        cm.Parameters.Add(p3)
        cm.Parameters.Add(p1)
        cm.ExecuteNonQuery()
        cm.Connection.Close()
        cm.Parameters.Clear()

        Me.lblok.Visible = True
        Me.DetailsView1.DataSource = Nothing
        Me.DetailsView1.DataBind()
        Me.dgOverzicht.DataSource = Nothing
        Me.dgOverzicht.DataBind()

    End Sub

    Protected Sub btnexcel_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnexcel.Click
        Dim sb As New System.Text.StringBuilder
        Dim rij As Integer
        'Dim kolom As Integer
        Dim filename As String
        filename = "verzuim.txt"


        sb.Append("pnnr / Naam" & Chr(9) & "Ziekte van" & Chr(9) & "Ziekte tot" & Chr(9) & "datum ziekteattest" & Chr(9) & "controle" & Chr(9) & "datum controle" & Chr(9) & "annulatie controle" & Chr(9) & "opmerkingen" & vbCrLf)
        For rij = 0 To Me.dgOverzicht.Rows.Count - 1
            Me.dgOverzicht.SelectedIndex = rij
            'gegevens uit gridview meenemen
            sb.Append(CType(Me.dgOverzicht.SelectedRow.FindControl("lblpnnr"), Label).Text & Chr(9))
            sb.Append(CType(Me.dgOverzicht.SelectedRow.FindControl("lbldatumvan"), Label).Text & Chr(9))
            sb.Append(CType(Me.dgOverzicht.SelectedRow.FindControl("lbldatumtot"), Label).Text & Chr(9))
            sb.Append(CType(Me.dgOverzicht.SelectedRow.FindControl("lbldatumziekteattest"), Label).Text & Chr(9))
            sb.Append(CType(Me.dgOverzicht.SelectedRow.FindControl("slkcontrole"), CheckBox).Checked & Chr(9))
            sb.Append(CType(Me.dgOverzicht.SelectedRow.FindControl("lbldatumcontrole"), Label).Text & Chr(9))
            sb.Append(CType(Me.dgOverzicht.SelectedRow.FindControl("slkcontroleannulatie"), CheckBox).Checked & Chr(9))
            sb.Append(CType(Me.dgOverzicht.SelectedRow.FindControl("txtopmerkingen"), TextBox).Text & vbCrLf)

        Next

        Response.ContentType = "Application/x-msexcel"
        Response.AddHeader("content-disposition", "attachement; filename=""" & filename & """")

        Response.Write(sb.ToString)
        Response.End()
    End Sub
End Class


I hope that i have provided enough information and that there's someone who can help me.

p.s. i allready looked arround for the same question on EE, but they all say that the field is not in the select querry. but if you check my vb file you'll see that on line 81 i have the field 'IdKeuze' in the Select query. Like i said in the beginning i'm realy new to this.

Thanks in advance Tom De Bie

Answer : DataBinding: 'System.Data.Common.DataRecordInternal' does not contain a property with the name 'IdKeuze'.

Figured out that you have to change all the URLs to the external URL of the sharepoint webapp, the SQL reporting server and then works good. I used this as reference -> http://tjopsta.net/2010/04/16/how-to-change-team-foundation-server-2010-urls-for-use-externally/#comment-44
Random Solutions  
 
programming4us programming4us