By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,619 Members | 1,534 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,619 IT Pros & Developers. It's quick & easy.

c# GridView and FormView write error "An OleDbParameter with ParameterName'@ID' is not contained by this OleDbParameterCollection"

P: n/a
DC
The problem

I'm using the .NET GridView and FormView objects for the first time and
im getting the error "An OleDbParameter with ParameterName '@ID' is not
contained by this OleDbParameterCollection" whenI try to write a new record.

Delete and Modify work fine its just the add record function causes the
error.
The Error.....

Server Error in '/' Application.
An OleDbParameter with ParameterName '@ID' is not contained by this
OleDbParameterCollection.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.IndexOutOfRangeException: An OleDbParameter
with ParameterName '@ID' is not contained by this OleDbParameterCollection.

Source Error:

Line 56: System.Data.Common.DbCommand command = e.Command;
Line 57:
Line 58:
MeetingsDetailsAccessDataSource.SelectParameters["ID"].DefaultValue =
command.Parameters["@ID"].Value.ToString();
Line 59:
Line 60: Response.Write(ID);
Source File: c:\Inetpub\wwwroot\Scripts\meetings\admin.aspx Line: 58

Stack Trace:

[IndexOutOfRangeException: An OleDbParameter with ParameterName '@ID' is
not contained by this OleDbParameterCollection.]
System.Data.OleDb.OleDbParameterCollection.GetPara meter(String
parameterName) +988993
System.Data.Common.DbParameterCollection.get_Item( String
parameterName) +7

ASP.scripts_meetings_admin_aspx.MeetingsDetailsAcc essDataSource_OnInserted(Object
sender, SqlDataSourceStatusEventArgs e) in
c:\Inetpub\wwwroot\Scripts\meetings\admin.aspx:58

System.Web.UI.WebControls.SqlDataSourceView.OnInse rted(SqlDataSourceStatusEventArgs
e) +114

System.Web.UI.WebControls.SqlDataSourceView.Execut eDbCommand(DbCommand
command, DataSourceOperation operation) +375

System.Web.UI.WebControls.SqlDataSourceView.Execut eInsert(IDictionary
values) +447
System.Web.UI.DataSourceView.Insert(IDictionary values,
DataSourceViewOperationCallback callback) +72
System.Web.UI.WebControls.FormView.HandleInsert(St ring commandArg,
Boolean causesValidation) +388
System.Web.UI.WebControls.FormView.HandleEvent(Eve ntArgs e, Boolean
causesValidation, String validationGroup) +623
System.Web.UI.WebControls.FormView.OnBubbleEvent(O bject source,
EventArgs e) +95
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
args) +35
System.Web.UI.WebControls.FormViewRow.OnBubbleEven t(Object source,
EventArgs e) +109
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
args) +35
System.Web.UI.WebControls.LinkButton.OnCommand(Com mandEventArgs e) +115
System.Web.UI.WebControls.LinkButton.RaisePostBack Event(String
eventArgument) +163

System.Web.UI.WebControls.LinkButton.System.Web.UI .IPostBackEventHandler.RaisePostBackEvent(String
eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +174
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102
The Full Code

The Code

<%@ import namespace="System" %>
<%@ import namespace="System.Web" %>
<%@ import namespace="System.Web.UI" %>
<%@ import namespace="System.Web.UI.HtmlControls" %>
<%@ import namespace="System.Web.UI.WebControls" %>
<%@ import namespace="System.Data" %>
<%@ import namespace="System.Data.OleDb" %>

<html>
<head>

<title>Meetings Admin Page</title>

<meta NAME="keywords" CONTENT="Meetings">

<meta NAME="description" CONTENT="Meetings Admin Page">

<meta name="MSSmartTagsPreventParsing" content="TRUE">

<script language="C#" runat="server">

public void Page_Load(object sender, System.EventArgs e)
{
if (Page.IsPostBack != true)
{

}
}

void MeetingsGridView_OnSelectedIndexChanged(Object sender, EventArgs e)
{
MeetingsDetailsAccessDataSource.SelectParameters["ID"].DefaultValue
= MeetingsGridView.SelectedValue.ToString();
MeetingsFormView.DataBind();
}
void MeetingsFormView_ItemUpdated(Object sender,
FormViewUpdatedEventArgs e)
{
MeetingsGridView.DataBind();
}

void MeetingsFormView_ItemDeleted(Object sender,
FormViewDeletedEventArgs e)
{
MeetingsGridView.DataBind();
}

void MeetingsDetailsAccessDataSource_OnInserted(Object sender,
SqlDataSourceStatusEventArgs e)
{

System.Data.Common.DbCommand command = e.Command;

MeetingsDetailsAccessDataSource.SelectParameters["ID"].DefaultValue =
command.Parameters["@ID"].Value.ToString();

Response.Write(ID);

MeetingsGridView.DataBind();
MeetingsFormView.DataBind();

}
</script>
</head>

<body bgcolor=#FFFFFF>

<!-- Start of page header section -->

<!-- Stylesheet Location -->

<link rel="stylesheet" type="text/css" href="/scripts/includes/style.css">

<!-- Page Header info goes here -->

<BR>

<center>

<H3>Seminars Admin Page</H3>

<form RunAt="server">

<table cellspacing="10">

<tr>

<td valign="top">
<asp:FormView ID="MeetingsFormView"
DataSourceID="MeetingsDetailsAccessDataSource"
DataKeyNames="ID"
Gridlines="Both"
OnItemUpdated="MeetingsFormView_ItemUpdated"
OnItemDeleted="MeetingsFormView_ItemDeleted"
RunAt="server">

<HeaderStyle backcolor="Navy"
forecolor="White"/>

<RowStyle backcolor="White"/>

<EditRowStyle backcolor="LightCyan"/>

<ItemTemplate>
<table>
<tr><td align=right><B>ID:</B></td><td><%#
Eval("ID") %></td></tr>
<tr><td align=right><B>Seminar Title:</B></td>
<td><%# Eval("SeminarTitle") %></td></tr>
<tr><td align=right><B>Speaker:</B></td <td><%#
Eval("Speaker") %></td></tr>
<tr><td align=right><B>Speaker Email:</B></td>
<td><%# Eval("SpeakerEmail") %></td></tr>
<tr><td align=right><B>Speaker
Institution:</B></td <td><%# Eval("SpeakerInstitution") %></td></tr>
<tr><td align=right><B>Seminar Date:</B></td>
<td><%# Eval("SeminarDate") %></td></tr>
<tr><td align=right><B>Seminar Time:</B></td>
<td><%# Eval("SeminarTime") %></td></tr>
<tr><td align=right><B>Seminar Location:</B></td>
<td><%# Eval("SeminarLocation") %></td></tr>
<tr><td align=right><B>Seminar Details:</B></td>
<td><%# Eval("SeminarDetails") %></td></tr>
<tr><td align=right><B>Seminar Host:</B></td>
<td><%# Eval("SeminarHost") %></td></tr>
<tr><td align=right><B>Seminar Host Email:</B></td>
<td><%# Eval("SeminarHostEmail") %></td></tr>
<tr><td align=right><B>Seminar Type:</B></td>
<td><%# Eval("SeminarType") %></td></tr>
<tr><td align=right><B>Organisation Notes:</B></td>
<td><%# Eval("OrganisationNotes") %></td></tr>

<tr>
<td colspan="2">
<asp:LinkButton ID="EditButton"
Text="Edit"
CommandName="Edit"
RunAt="server"/>
&nbsp;
<asp:LinkButton ID="NewButton"
Text="New"
CommandName="New"
RunAt="server"/>
&nbsp;
<asp:LinkButton ID="DeleteButton"
Text="Delete"
CommandName="Delete"
RunAt="server"/>
</td>
</tr>
</table>
</ItemTemplate>

<EditItemTemplate>
<table>
<tr><td align=right><B>ID:</B></td><td><%#
Eval("ID") %></td></tr>

<tr><td align=right><B>Seminar Title:</B></td>
<td><asp:TextBox ID="EditSeminarTitleTextBox"
Text='<%# Bind("SeminarTitle")
%>'
RunAt="Server" /></td></tr>

<tr><td align=right><B>Speaker:</B></td>
<td><asp:TextBox ID="EditSpeakerTextBox"
Text='<%# Bind("Speaker") %>'
RunAt="Server" /></td></tr>

<tr><td align=right><B>Speaker Email:</B></td>
<td><asp:TextBox ID="EditSpeakerEmailTextBox"
Text='<%# Bind("SpeakerEmail")
%>'
RunAt="Server" /></td></tr>

<tr><td align=right><B>Speaker Institution:</B></td>
<td><asp:TextBox
ID="EditSpeakerInstitutionTextBox"
Text='<%#
Bind("SpeakerInstitution") %>'
RunAt="Server" /></td></tr>

<tr><td align=right><B>Seminar Date:</B></td>
<td><asp:TextBox ID="EditSeminarDateTextBox"
Text='<%# Bind("SeminarDate") %>'
RunAt="Server" /></td></tr>

<tr><td align=right><B>Seminar Time:</B></td>
<td><asp:TextBox ID="EditSeminarTimeTextBox"
Text='<%# Bind("SeminarTime") %>'
RunAt="Server" /></td></tr>

<tr><td align=right><B>Seminar Location:</B></td>
<td><asp:TextBox ID="EditSeminarLocationTextBox"
Text='<%#
Bind("SeminarLocation") %>'
RunAt="Server" /></td></tr>

<tr><td align=right><B>Seminar Details:</B></td>
<td><asp:TextBox ID="EditSeminarDetailsTextBox"
Text='<%#
Bind("SeminarDetails") %>'
RunAt="Server" /></td></tr>

<tr><td align=right><B>Seminar Host:</B></td>
<td><asp:TextBox ID="EditSeminarHostTextBox"
Text='<%# Bind("SeminarHost") %>'
RunAt="Server" /></td></tr>

<tr><td align=right><B>Seminar Host Email:</B></td>
<td><asp:TextBox ID="EditSeminarHostEmailTextBox"
Text='<%#
Bind("SeminarHostEmail") %>'
RunAt="Server" /></td></tr>

<tr><td align=right><B>Seminar Type:</B></td>
<td><asp:TextBox ID="EditSeminarTypeTextBox"
Text='<%# Bind("SeminarType") %>'
RunAt="Server" /></td></tr>

<tr><td align=right><B>Organisation Notes:</B></td>
<td><asp:TextBox ID="EditOrganisationNotesTextBox"
Text='<%#
Bind("OrganisationNotes") %>'
RunAt="Server" /></td></tr>

<tr>
<td colspan="2">
<asp:LinkButton ID="UpdateButton"
Text="Update"
CommandName="Update"
RunAt="server"/>
&nbsp;
<asp:LinkButton ID="CancelUpdateButton"
Text="Cancel"
CommandName="Cancel"
RunAt="server"/>
</td>
</tr>
</table>
</EditItemTemplate>

<InsertItemTemplate>
<table>
<tr><td align=right><B>Seminar Title:</B></td>
<td><asp:TextBox ID="InsertSeminarTitleTextBox"
Text='Seminar Title'
RunAt="Server" /></td></tr>

<tr><td align=right><B>Speaker:</B></td>
<td><asp:TextBox ID="InsertSpeakerTextBox"
Text='Speaker Name'
RunAt="Server" /></td></tr>

<tr><td align=right><B>Speaker Email:</B></td>
<td><asp:TextBox ID="InsertSpeakerEmailTextBox"
Te***********@rdg.ac.uk'
RunAt="Server" /></td></tr>

<tr><td align=right><B>Speaker Institution:</B></td>
<td><asp:TextBox
ID="InsertSpeakerInstitutionTextBox"
Text='Reading Meteorlogy Dept'
RunAt="Server" /></td></tr>

<tr><td align=right><B>Seminar Date:</B></td>
<td><asp:TextBox ID="InsertSeminarDateTextBox"
Text='1/1/2006'
RunAt="Server" /></td></tr>

<tr><td align=right><B>Seminar Time:</B></td>
<td><asp:TextBox ID="InsertSeminarTimeTextBox"
Text='12.00'
RunAt="Server" /></td></tr>

<tr><td align=right><B>Seminar Location:</B></td>
<td><asp:TextBox ID="InsertSeminarLocationTextBox"
Text='Sutcliffe Lecture
Theatre (GU01)'
RunAt="Server" /></td></tr>

<tr><td align=right><B>Seminar Details:</B></td>
<td><asp:TextBox ID="InsertSeminarDetailsTextBox"
Text='Add some Seminar Details'
RunAt="Server" /></td></tr>

<tr><td align=right><B>Seminar Host:</B></td>
<td><asp:TextBox ID="InsertSeminarHostTextBox"
Text='Seminar Host'
RunAt="Server" /></td></tr>

<tr><td align=right><B>Seminar Host Email:</B></td>
<td><asp:TextBox
ID="InsertSeminarHostEmailTextBox"
Te***********@rdg.ac.uk'
RunAt="Server" /></td></tr>

<tr><td align=right><B>Seminar Type:</B></td>
<td><asp:TextBox ID="InsertSeminarTypeTextBox"
Text='Lunchtime Seminar'
RunAt="Server" /></td></tr>

<tr><td align=right><B>Organisation Notes:</B></td>
<td><asp:TextBox
ID="InsertOrganisationNotesTextBox"
Text='Organisation Notes'
RunAt="Server" /></td></tr>

<tr>
<td colspan="2">
<asp:LinkButton ID="InsertButton"
Text="Insert"
CommandName="Insert"
RunAt="server"/>
&nbsp;
<asp:LinkButton ID="CancelInsertButton"
Text="Cancel"
CommandName="Cancel"
RunAt="server"/>
</td>
</tr>
</table>
</InsertItemTemplate>

</asp:FormView>

</td>
</tr>
<tr>
<td>
<asp:GridView ID="MeetingsGridView"
DataSourceID="MeetingsAccessDataSource"
AutoGenerateColumns="false"
DataKeyNames="ID"

OnSelectedIndexChanged="MeetingsGridView_OnSelecte dIndexChanged"
RunAt="Server">

<HeaderStyle backcolor="cornsilk"
forecolor="Black" />

<Columns>

<asp:ButtonField Text="Show Details."
HeaderText="Show<BR>Details"
CommandName="Select"/>

<asp:BoundField DataField="ID" HeaderText="Item ID"/>
<asp:BoundField DataField="SeminarTitle"
HeaderText="Seminar Title"/>
<asp:BoundField DataField="Speaker"
HeaderText="Speaker"/>
<asp:BoundField DataField="SpeakerEmail" HeaderText="Speaker Email"/>
<asp:BoundField DataField="SpeakerInstitution" HeaderText="Speaker
Institution"/>
<asp:BoundField DataField="SeminarDate" HeaderText="Seminar Date"/>
<asp:BoundField DataField="SeminarTime" HeaderText="Seminar
Time"/>
<asp:BoundField DataField="SeminarLocation"
HeaderText="Seminar Location"/>

</Columns>

</asp:GridView>

</td>

</tr>

</table>

<asp:AccessDataSource
id="MeetingsAccessDataSource"
runat="server"
datasourcemode="DataSet"
DataFile="C:\\Program Files\\Common Files\\ODBC\\Data
Sources\\seminars.mdb"

SelectCommand="SELECT * FROM SeminarList">

</asp:AccessDataSource>
<asp:AccessDataSource
id="MeetingsDetailsAccessDataSource"
runat="server"
datasourcemode="DataSet"
DataFile="C:\\Program Files\\Common Files\\ODBC\\Data
Sources\\seminars.mdb"

SelectCommand="SELECT * FROM SeminarList WHERE ID=@ID"

InsertCommand="INSERT INTO SeminarList
(ID,SeminarTitle,Speaker,SpeakerEmail,SpeakerInsti tution,SeminarDate,SeminarTime,SeminarLocation,Sem inarDetails,SeminarHost,SeminarHostEmail,SeminarTy pe,OrganisationNotes)
VALUES (@ID,
@SeminarTitle,@Speaker,@SpeakerEmail,@SpeakerInsti tution,@SeminarDate,@SeminarTime,@SeminarLocation, @SeminarDetails,@SeminarHost,@SeminarHostEmail,@Se minarType,@OrganisationNotes)"

UpdateCommand="UPDATE SeminarList SET
SeminarTitle=@SeminarTitle,Speaker=@Speaker,Speake rEmail=@SpeakerEmail,SpeakerInstitution=@SpeakerIn stitution,SeminarDate=@SeminarDate,SeminarTime=@Se minarTime,SeminarLocation=@SeminarLocation,Seminar Details=@SeminarDetails,SeminarHost=@SeminarHost,S eminarHostEmail=@SeminarHostEmail,SeminarType=@Sem inarType,OrganisationNotes=@OrganisationNotes
WHERE ID=@ID"

DeleteCommand="DELETE FROM SeminarList WHERE ID=@ID"

OnInserted="MeetingsDetailsAccessDataSource_OnInse rted">
<SelectParameters>
<asp:QueryStringParameter Name="ID" Type="Int32"
QueryStringField="ID" />

</SelectParameters>

<InsertParameters>
<asp:Parameter Name="SeminarTitle" Direction="Output" Type="String"
DefaultValue="Seminar Title" />
<asp:Parameter Name="Speaker" Direction="Output" Type="String"
DefaultValue="Speaker" />
<asp:Parameter Name="SpeakerEmail" Direction="Output" Type="String"
DefaultValue="so*****@rdg.ac.uk" />
<asp:Parameter Name="SpeakerInstitution" Direction="Output"
Type="String" DefaultValue="Speaker Institution" />
<asp:Parameter Name="SeminarDate" Direction="Output"
Type="DateTime" DefaultValue="1/1/2006" />
<asp:Parameter Name="SeminarTime" Direction="Output" Type="String"
DefaultValue="12.00" />
<asp:Parameter Name="SeminarLocation" Direction="Output"
Type="String" DefaultValue="Seminar Location" />
<asp:Parameter Name="SeminarDetails" Direction="Output"
Type="String" DefaultValue="Seminar Details" />
<asp:Parameter Name="SeminarHost" Direction="Output" Type="String"
DefaultValue="Seminar Host" />
<asp:Parameter Name="SeminarHostEmail" Direction="Output"
Type="String" DefaultValue="so*****@rdg.ac.uk" />
<asp:Parameter Name="SeminarType" Direction="Output" Type="String"
DefaultValue="Lunchtime Seminar" />
<asp:Parameter Name="OrganisationNotes" Direction="Output"
Type="String" DefaultValue="Organisation Notes" />
</InsertParameters>

</asp:AccessDataSource>

</form>

</center>

</body>

</html><%@ import namespace="System" %>
<%@ import namespace="System.Web" %>
<%@ import namespace="System.Web.UI" %>
<%@ import namespace="System.Web.UI.HtmlControls" %>
<%@ import namespace="System.Web.UI.WebControls" %>
<%@ import namespace="System.Data" %>
<%@ import namespace="System.Data.OleDb" %>

<html>
<head>

<title>Meteorology Department Meetings Admin Page</title>

<meta NAME="keywords" CONTENT="meteorology dept, Meetings">

<meta NAME="description" CONTENT="Meteorology Department Meetings Admin
Page">
<meta NAME="htdig-email" CONTENT="we****@met.rdg.ac.uk">

<META HTTP-EQUIV=REFRESH CONTENT=1800>

<link REL="ICON" HREF="http://www.met.rdg.ac.uk/favicon.ico">
<link REL="SHORTCUT ICON" HREF="http://www.met.rdg.ac.uk/favicon.ico">

<meta name="MSSmartTagsPreventParsing" content="TRUE">

<script language="C#" runat="server">

public void Page_Load(object sender, System.EventArgs e)
{
if (Page.IsPostBack != true)
{

}
}

void MeetingsGridView_OnSelectedIndexChanged(Object sender, EventArgs e)
{
MeetingsDetailsAccessDataSource.SelectParameters["ID"].DefaultValue
= MeetingsGridView.SelectedValue.ToString();
MeetingsFormView.DataBind();
}
void MeetingsFormView_ItemUpdated(Object sender,
FormViewUpdatedEventArgs e)
{
MeetingsGridView.DataBind();
}

void MeetingsFormView_ItemDeleted(Object sender,
FormViewDeletedEventArgs e)
{
MeetingsGridView.DataBind();
}

void MeetingsDetailsAccessDataSource_OnInserted(Object sender,
SqlDataSourceStatusEventArgs e)
{

System.Data.Common.DbCommand command = e.Command;

MeetingsDetailsAccessDataSource.SelectParameters["ID"].DefaultValue =
command.Parameters["@ID"].Value.ToString();

Response.Write(ID);

MeetingsGridView.DataBind();
MeetingsFormView.DataBind();

}
</script>
</head>

<body bgcolor=#FFFFFF>

<!-- Start of page header section -->

<!-- Stylesheet Location -->

<link rel="stylesheet" type="text/css"
href="/scripts/includes/metstyle.css">

<!-- Page Header info goes here -->

<table width="100%" border="0" cellpadding="0" cellspacing="0">
<!-- Left hand header graphic goes here -->
<tr>
<td class="greenborders">
<a href ="http://www.met.rdg.ac.uk/" alt="Meteorology Department Home Page">
<img src="http://www.met.rdg.ac.uk/images/metdeptleft.jpg" border ="0">
</A>
</td>

<!-- Right hand header graphic or text goes here -->
<td class="greenborders" align=right>
<img src="http://www.met.rdg.ac.uk/images/metpicturesright.gif">
</td>
</tr>

<style>
..Caption {
font-size: 12pt
font-family: sans-serif;
font-weight: bold;
color: #447744;
}
</style>

<!-- End of page header section -->

<!--Crumbtrail or Quicklink topmenu bar data goes here -->
<tr>
<td colspan="2" class="greenbordersbgc">
<smallgreen>Location: <a
href="http://www.metnt.rdg.ac.uk/scripts/meetings/admin.aspx"
class="breadcrumbs">Met Dept Seminars Admin Page</a>
</td>
</tr>

</table>
<BR>

<center>

<H3>Met Dept Seminars Admin Page</H3>

<form RunAt="server">

<table cellspacing="10">

<tr>

<td valign="top">
<asp:FormView ID="MeetingsFormView"
DataSourceID="MeetingsDetailsAccessDataSource"
DataKeyNames="ID"
Gridlines="Both"
OnItemUpdated="MeetingsFormView_ItemUpdated"
OnItemDeleted="MeetingsFormView_ItemDeleted"
RunAt="server">

<HeaderStyle backcolor="Navy"
forecolor="White"/>

<RowStyle backcolor="White"/>

<EditRowStyle backcolor="LightCyan"/>

<ItemTemplate>
<table>
<tr><td align=right><B>ID:</B></td><td><%#
Eval("ID") %></td></tr>
<tr><td align=right><B>Seminar Title:</B></td>
<td><%# Eval("SeminarTitle") %></td></tr>
<tr><td align=right><B>Speaker:</B></td <td><%#
Eval("Speaker") %></td></tr>
<tr><td align=right><B>Speaker Email:</B></td>
<td><%# Eval("SpeakerEmail") %></td></tr>
<tr><td align=right><B>Speaker
Institution:</B></td <td><%# Eval("SpeakerInstitution") %></td></tr>
<tr><td align=right><B>Seminar Date:</B></td>
<td><%# Eval("SeminarDate") %></td></tr>
<tr><td align=right><B>Seminar Time:</B></td>
<td><%# Eval("SeminarTime") %></td></tr>
<tr><td align=right><B>Seminar Location:</B></td>
<td><%# Eval("SeminarLocation") %></td></tr>
<tr><td align=right><B>Seminar Details:</B></td>
<td><%# Eval("SeminarDetails") %></td></tr>
<tr><td align=right><B>Seminar Host:</B></td>
<td><%# Eval("SeminarHost") %></td></tr>
<tr><td align=right><B>Seminar Host Email:</B></td>
<td><%# Eval("SeminarHostEmail") %></td></tr>
<tr><td align=right><B>Seminar Type:</B></td>
<td><%# Eval("SeminarType") %></td></tr>
<tr><td align=right><B>Organisation Notes:</B></td>
<td><%# Eval("OrganisationNotes") %></td></tr>

<tr>
<td colspan="2">
<asp:LinkButton ID="EditButton"
Text="Edit"
CommandName="Edit"
RunAt="server"/>
&nbsp;
<asp:LinkButton ID="NewButton"
Text="New"
CommandName="New"
RunAt="server"/>
&nbsp;
<asp:LinkButton ID="DeleteButton"
Text="Delete"
CommandName="Delete"
RunAt="server"/>
</td>
</tr>
</table>
</ItemTemplate>

<EditItemTemplate>
<table>
<tr><td align=right><B>ID:</B></td><td><%#
Eval("ID") %></td></tr>

<tr><td align=right><B>Seminar Title:</B></td>
<td><asp:TextBox ID="EditSeminarTitleTextBox"
Text='<%# Bind("SeminarTitle")
%>'
RunAt="Server" /></td></tr>

<tr><td align=right><B>Speaker:</B></td>
<td><asp:TextBox ID="EditSpeakerTextBox"
Text='<%# Bind("Speaker") %>'
RunAt="Server" /></td></tr>

<tr><td align=right><B>Speaker Email:</B></td>
<td><asp:TextBox ID="EditSpeakerEmailTextBox"
Text='<%# Bind("SpeakerEmail")
%>'
RunAt="Server" /></td></tr>

<tr><td align=right><B>Speaker Institution:</B></td>
<td><asp:TextBox
ID="EditSpeakerInstitutionTextBox"
Text='<%#
Bind("SpeakerInstitution") %>'
RunAt="Server" /></td></tr>

<tr><td align=right><B>Seminar Date:</B></td>
<td><asp:TextBox ID="EditSeminarDateTextBox"
Text='<%# Bind("SeminarDate") %>'
RunAt="Server" /></td></tr>

<tr><td align=right><B>Seminar Time:</B></td>
<td><asp:TextBox ID="EditSeminarTimeTextBox"
Text='<%# Bind("SeminarTime") %>'
RunAt="Server" /></td></tr>

<tr><td align=right><B>Seminar Location:</B></td>
<td><asp:TextBox ID="EditSeminarLocationTextBox"
Text='<%#
Bind("SeminarLocation") %>'
RunAt="Server" /></td></tr>

<tr><td align=right><B>Seminar Details:</B></td>
<td><asp:TextBox ID="EditSeminarDetailsTextBox"
Text='<%#
Bind("SeminarDetails") %>'
RunAt="Server" /></td></tr>

<tr><td align=right><B>Seminar Host:</B></td>
<td><asp:TextBox ID="EditSeminarHostTextBox"
Text='<%# Bind("SeminarHost") %>'
RunAt="Server" /></td></tr>

<tr><td align=right><B>Seminar Host Email:</B></td>
<td><asp:TextBox ID="EditSeminarHostEmailTextBox"
Text='<%#
Bind("SeminarHostEmail") %>'
RunAt="Server" /></td></tr>

<tr><td align=right><B>Seminar Type:</B></td>
<td><asp:TextBox ID="EditSeminarTypeTextBox"
Text='<%# Bind("SeminarType") %>'
RunAt="Server" /></td></tr>

<tr><td align=right><B>Organisation Notes:</B></td>
<td><asp:TextBox ID="EditOrganisationNotesTextBox"
Text='<%#
Bind("OrganisationNotes") %>'
RunAt="Server" /></td></tr>

<tr>
<td colspan="2">
<asp:LinkButton ID="UpdateButton"
Text="Update"
CommandName="Update"
RunAt="server"/>
&nbsp;
<asp:LinkButton ID="CancelUpdateButton"
Text="Cancel"
CommandName="Cancel"
RunAt="server"/>
</td>
</tr>
</table>
</EditItemTemplate>

<InsertItemTemplate>
<table>
<tr><td align=right><B>Seminar Title:</B></td>
<td><asp:TextBox ID="InsertSeminarTitleTextBox"
Text='Seminar Title'
RunAt="Server" /></td></tr>

<tr><td align=right><B>Speaker:</B></td>
<td><asp:TextBox ID="InsertSpeakerTextBox"
Text='Speaker Name'
RunAt="Server" /></td></tr>

<tr><td align=right><B>Speaker Email:</B></td>
<td><asp:TextBox ID="InsertSpeakerEmailTextBox"
Te***********@rdg.ac.uk'
RunAt="Server" /></td></tr>

<tr><td align=right><B>Speaker Institution:</B></td>
<td><asp:TextBox
ID="InsertSpeakerInstitutionTextBox"
Text='Reading Meteorlogy Dept'
RunAt="Server" /></td></tr>

<tr><td align=right><B>Seminar Date:</B></td>
<td><asp:TextBox ID="InsertSeminarDateTextBox"
Text='1/1/2006'
RunAt="Server" /></td></tr>

<tr><td align=right><B>Seminar Time:</B></td>
<td><asp:TextBox ID="InsertSeminarTimeTextBox"
Text='12.00'
RunAt="Server" /></td></tr>

<tr><td align=right><B>Seminar Location:</B></td>
<td><asp:TextBox ID="InsertSeminarLocationTextBox"
Text='Sutcliffe Lecture
Theatre (GU01)'
RunAt="Server" /></td></tr>

<tr><td align=right><B>Seminar Details:</B></td>
<td><asp:TextBox ID="InsertSeminarDetailsTextBox"
Text='Add some Seminar Details'
RunAt="Server" /></td></tr>

<tr><td align=right><B>Seminar Host:</B></td>
<td><asp:TextBox ID="InsertSeminarHostTextBox"
Text='Seminar Host'
RunAt="Server" /></td></tr>

<tr><td align=right><B>Seminar Host Email:</B></td>
<td><asp:TextBox
ID="InsertSeminarHostEmailTextBox"
Te***********@rdg.ac.uk'
RunAt="Server" /></td></tr>

<tr><td align=right><B>Seminar Type:</B></td>
<td><asp:TextBox ID="InsertSeminarTypeTextBox"
Text='Lunchtime Seminar'
RunAt="Server" /></td></tr>

<tr><td align=right><B>Organisation Notes:</B></td>
<td><asp:TextBox
ID="InsertOrganisationNotesTextBox"
Text='Organisation Notes'
RunAt="Server" /></td></tr>

<tr>
<td colspan="2">
<asp:LinkButton ID="InsertButton"
Text="Insert"
CommandName="Insert"
RunAt="server"/>
&nbsp;
<asp:LinkButton ID="CancelInsertButton"
Text="Cancel"
CommandName="Cancel"
RunAt="server"/>
</td>
</tr>
</table>
</InsertItemTemplate>

</asp:FormView>

</td>
</tr>
<tr>
<td>
<asp:GridView ID="MeetingsGridView"
DataSourceID="MeetingsAccessDataSource"
AutoGenerateColumns="false"
DataKeyNames="ID"

OnSelectedIndexChanged="MeetingsGridView_OnSelecte dIndexChanged"
RunAt="Server">

<HeaderStyle backcolor="cornsilk"
forecolor="Black" />

<Columns>

<asp:ButtonField Text="Show Details."
HeaderText="Show<BR>Details"
CommandName="Select"/>

<asp:BoundField DataField="ID" HeaderText="Item ID"/>
<asp:BoundField DataField="SeminarTitle"
HeaderText="Seminar Title"/>
<asp:BoundField DataField="Speaker"
HeaderText="Speaker"/>
<asp:BoundField DataField="SpeakerEmail" HeaderText="Speaker Email"/>
<asp:BoundField DataField="SpeakerInstitution" HeaderText="Speaker
Institution"/>
<asp:BoundField DataField="SeminarDate" HeaderText="Seminar Date"/>
<asp:BoundField DataField="SeminarTime" HeaderText="Seminar
Time"/>
<asp:BoundField DataField="SeminarLocation"
HeaderText="Seminar Location"/>

</Columns>

</asp:GridView>

</td>

</tr>

</table>

<asp:AccessDataSource
id="MeetingsAccessDataSource"
runat="server"
datasourcemode="DataSet"
DataFile="C:\\Program Files\\Common Files\\ODBC\\Data
Sources\\seminars.mdb"

SelectCommand="SELECT * FROM SeminarList">

</asp:AccessDataSource>
<asp:AccessDataSource
id="MeetingsDetailsAccessDataSource"
runat="server"
datasourcemode="DataSet"
DataFile="C:\\Program Files\\Common Files\\ODBC\\Data
Sources\\seminars.mdb"

SelectCommand="SELECT * FROM SeminarList WHERE ID=@ID"

InsertCommand="INSERT INTO SeminarList
(ID,SeminarTitle,Speaker,SpeakerEmail,SpeakerInsti tution,SeminarDate,SeminarTime,SeminarLocation,Sem inarDetails,SeminarHost,SeminarHostEmail,SeminarTy pe,OrganisationNotes)
VALUES (@ID,
@SeminarTitle,@Speaker,@SpeakerEmail,@SpeakerInsti tution,@SeminarDate,@SeminarTime,@SeminarLocation, @SeminarDetails,@SeminarHost,@SeminarHostEmail,@Se minarType,@OrganisationNotes)"

UpdateCommand="UPDATE SeminarList SET
SeminarTitle=@SeminarTitle,Speaker=@Speaker,Speake rEmail=@SpeakerEmail,SpeakerInstitution=@SpeakerIn stitution,SeminarDate=@SeminarDate,SeminarTime=@Se minarTime,SeminarLocation=@SeminarLocation,Seminar Details=@SeminarDetails,SeminarHost=@SeminarHost,S eminarHostEmail=@SeminarHostEmail,SeminarType=@Sem inarType,OrganisationNotes=@OrganisationNotes
WHERE ID=@ID"

DeleteCommand="DELETE FROM SeminarList WHERE ID=@ID"

OnInserted="MeetingsDetailsAccessDataSource_OnInse rted">
<SelectParameters>
<asp:QueryStringParameter Name="ID" Type="Int32"
QueryStringField="ID" />

</SelectParameters>

<InsertParameters>
<asp:Parameter Name="SeminarTitle" Direction="Output" Type="String"
DefaultValue="Seminar Title" />
<asp:Parameter Name="Speaker" Direction="Output" Type="String"
DefaultValue="Speaker" />
<asp:Parameter Name="SpeakerEmail" Direction="Output" Type="String"
DefaultValue="so*****@rdg.ac.uk" />
<asp:Parameter Name="SpeakerInstitution" Direction="Output"
Type="String" DefaultValue="Speaker Institution" />
<asp:Parameter Name="SeminarDate" Direction="Output"
Type="DateTime" DefaultValue="1/1/2006" />
<asp:Parameter Name="SeminarTime" Direction="Output" Type="String"
DefaultValue="12.00" />
<asp:Parameter Name="SeminarLocation" Direction="Output"
Type="String" DefaultValue="Seminar Location" />
<asp:Parameter Name="SeminarDetails" Direction="Output"
Type="String" DefaultValue="Seminar Details" />
<asp:Parameter Name="SeminarHost" Direction="Output" Type="String"
DefaultValue="Seminar Host" />
<asp:Parameter Name="SeminarHostEmail" Direction="Output"
Type="String" DefaultValue="so*****@rdg.ac.uk" />
<asp:Parameter Name="SeminarType" Direction="Output" Type="String"
DefaultValue="Lunchtime Seminar" />
<asp:Parameter Name="OrganisationNotes" Direction="Output"
Type="String" DefaultValue="Organisation Notes" />
</InsertParameters>

</asp:AccessDataSource>

</form>

</center>

</body>

</html>
Oct 5 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.