none
我在新增一筆資料時有錯誤 請問各位是哪裡有錯誤? RRS feed

  • 問題

  •  

     

     

     

    我在新增一筆資料時 遇到了這張圖片中的錯誤

    請問各位這是哪裡出錯誤了?

    2007年11月25日 下午 01:51

解答

  • hi 你好:

    你可以看一下msdn http://msdn2.microsoft.com/En-US/library/system.web.ui.webcontrols.sqldatasource.insertparameters.aspx

    你沒有建立sqlDataSource.InsertCommand ,再試試吧^^

                                                                                                                    馬小玲

    2007年11月25日 下午 02:26
  • HI,

     

    請切換到網頁的[原始檔]編輯畫面, 注意SqlDataSource控制項的<InsertParameters:>中的參數名稱(紅字部分)是否寫錯了

     

    <aspTongue TiedqlDataSource ID="dsEmployee" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
                DeleteCommand="DELETE FROM [Employees] WHERE [EmployeeID] = @EmployeeID" InsertCommand="INSERT INTO [Employees] ([LastName], [FirstName], [Title]) VALUES (@LastName, @FirstName, @Title)"
                SelectCommand="SELECT [EmployeeID], [LastName], [FirstName], [Title] FROM [Employees]"
                UpdateCommand="UPDATE [Employees] SET [LastName] = @LastName, [FirstName] = @FirstName, [Title] = @Title WHERE [EmployeeID] = @EmployeeID">
                <DeleteParameters>
                    <aspStick out tonguearameter Name="EmployeeID" Type="Int32" />
                </DeleteParameters>
                <UpdateParameters>
                    <aspStick out tonguearameter Name="LastName" Type="String" />
                    <aspStick out tonguearameter Name="FirstName" Type="String" />
                    <aspStick out tonguearameter Name="Title" Type="String" />
                    <aspStick out tonguearameter Name="EmployeeID" Type="Int32" />
                </UpdateParameters>
                <InsertParameters>
                    <aspStick out tonguearameter Name="LastName" Type="String" />
                    <aspStick out tonguearameter Name="FirstName" Type="String" />
                    <aspStick out tonguearameter Name="Title" Type="String" />
                </InsertParameters>
            </aspTongue TiedqlDataSource>

     

    tihs

    2007年11月26日 上午 04:25

所有回覆

  • hi 你好:

    你可以看一下msdn http://msdn2.microsoft.com/En-US/library/system.web.ui.webcontrols.sqldatasource.insertparameters.aspx

    你沒有建立sqlDataSource.InsertCommand ,再試試吧^^

                                                                                                                    馬小玲

    2007年11月25日 下午 02:26
  • HI,

     

    請切換到網頁的[原始檔]編輯畫面, 注意SqlDataSource控制項的<InsertParameters:>中的參數名稱(紅字部分)是否寫錯了

     

    <aspTongue TiedqlDataSource ID="dsEmployee" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
                DeleteCommand="DELETE FROM [Employees] WHERE [EmployeeID] = @EmployeeID" InsertCommand="INSERT INTO [Employees] ([LastName], [FirstName], [Title]) VALUES (@LastName, @FirstName, @Title)"
                SelectCommand="SELECT [EmployeeID], [LastName], [FirstName], [Title] FROM [Employees]"
                UpdateCommand="UPDATE [Employees] SET [LastName] = @LastName, [FirstName] = @FirstName, [Title] = @Title WHERE [EmployeeID] = @EmployeeID">
                <DeleteParameters>
                    <aspStick out tonguearameter Name="EmployeeID" Type="Int32" />
                </DeleteParameters>
                <UpdateParameters>
                    <aspStick out tonguearameter Name="LastName" Type="String" />
                    <aspStick out tonguearameter Name="FirstName" Type="String" />
                    <aspStick out tonguearameter Name="Title" Type="String" />
                    <aspStick out tonguearameter Name="EmployeeID" Type="Int32" />
                </UpdateParameters>
                <InsertParameters>
                    <aspStick out tonguearameter Name="LastName" Type="String" />
                    <aspStick out tonguearameter Name="FirstName" Type="String" />
                    <aspStick out tonguearameter Name="Title" Type="String" />
                </InsertParameters>
            </aspTongue TiedqlDataSource>

     

    tihs

    2007年11月26日 上午 04:25