()切换到Source View并找到<InsertParameters>集合修改它们以使它们从四个输入控件中获取信息如下面整个aspx页面代码中的阴影部分所示
<%@ Page Language=VB MasterPageFile=~/sitemaster AutoEventWireup=false CodeFile=GalleryUploadEnhancedaspxvb Inherits=GalleryUpload title=Untitled Page %>
<asp:Content ID=Content ContentPlaceHolderID=mainContent Runat=Server>
<h>Upload your photos from matches</h>
<br /><br />Please enter the name of the photo file:
<asp:FileUpload ID=FileUpload runat=server />
<br /><br />
Match Date:
<asp:ListBox ID=ListBox runat=server
DataSourceID=SqlDataSource
DataTextField=FixtureDate
DataValueField=FixtureID>
</asp:ListBox>
<asp:SqlDataSource ID=SqlDataSource runat=server
ConnectionString=<%$ ConnectionStrings:WroxUnitedConnectionString %>
SelectCommand=SELECT [FixtureID] [FIxtureDate] FROM [Fixtures]>
</asp:SqlDataSource>
<br /><br />
User Name: <asp:TextBox ID=TextBoxMemberName runat=server></asp:TextBox>
<br /><br />
Comments: <asp:TextBox ID=TextBoxNotes runat=server></asp:TextBox>
<br /><br />
<asp:Button ID=Button runat=server Text=Upload /><br />
<asp:Label ID=FileUploadReport runat=server></asp:Label><br />
<asp:SqlDataSource ID=SqlDataSource runat=server
ConflictDetection=CompareAllValues
ConnectionString=<%$ ConnectionStrings:WroxUnitedConnectionString %>
InsertCommand=INSERT INTO [Gallery] ([FixtureID] [UploadedByMemberName] [Notes] [PictureURL]) VALUES (@FixtureID@UploadedByMemberName@Notes@PictureURL)
OldValuesParameterFormatString=original_{} >
<InsertParameters>
<asp:ControlParameter Name=FixtureID
ControlID=ListBox
PropertyName=SelectedValue
Type=Int />
<asp:ControlParameter Name=UploadedByMemberName
ControlID=TextBoxMemberName
PropertyName=Text
Type=String />
<asp:ControlParameter Name=Notes
ControlID=TextBoxNotes
PropertyName=Text
Type=String />
<asp:ControlParameter Name=PictureURL
ControlID=FileUpload
PropertyName=FileName
Type=String />
</InsertParameters>
</asp:SqlDataSource>
</asp:Content>
[] [] []