熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

ASP.NET入門教程 8.6 改善圖片上傳功能[2]

2022-06-13   來源: .NET編程 

    ()切換到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>

[]  []  []  


From:http://tw.wingwit.com/Article/program/net/201311/14816.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.