问题与插入和更新 [英] Issue with inserts and updates

查看:158
本文介绍了问题与插入和更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在ASP.NET/C#一个小白,但我会尽我所能来形容我的问题是最好的,我可以。

现在我有一个具有连接到它的SQL源的gridview的;它抓住了正确的信息。 GridView的信息将取决于什么是在一个下拉列表,它是网格,其工作之外的选择改变。问题在于更新和插入内。

在尝试更新。 (当我点击的一列编辑)我收到以下错误信息:DropDownList2'有SelectedValue的,因为它不会在项目列表中存在哪些无效。
参数名称:值

我分裂成列模板,如下图所示,这样我就可以更容易管理。 下拉列表2位于我的编辑模板。它被连接到一个数据源;这是完全相同的源作为我的第一个dropdownmenu它完美的作品。所以,我不相信这将是过程背后的SQL。然而,我确实有这个DropDownList的2势必医生。
    现在有人告诉我,约束它,所以我不知道该怎么绑定工作,

如果我解除的话,我至少可以看到仍然之后我点击编辑网格,但我更新后,我得到的错误信息:过程或函数uspPatientUpdate具有指定的参数太多

现在,我在网上找了一个解决方案,但我不能换我的头周围均有约束力。我给下面的code是必要的。

ASP:

 < ASP:SqlDataSource的ID =sdPatient=服务器的ConnectionString =<%$的ConnectionStrings:MedicalOfficeConnectionString%>中DeleteCommand会=usp_PatientDelete的InsertCommand =uspPatientInsert的SelectCommand =uspPatientSelectByIDOrSelectAll的UpdateCommand =uspPatientUpdateSelectCommandType =StoredProcedure的DeleteCommandType =StoredProcedure的InsertCommandType =StoredProcedure的UpdateCommandType =StoredProcedure的>
                < D​​eleteParameters>
                    < ASP:参数名称=ID类型=的Int32/>
                < / DeleteParameters>
                < InsertParameters>
                    < ASP:参数名称=OHIP类型=字符串/>
                    < ASP:参数名称=名字类型=字符串/>
                    < ASP:参数名称=姓氏类型=字符串/>
                    < ASP:参数的DbType =日期NAME =DOB/>
                    < ASP:参数名称=VisitsPerYearTYPE =的Int32/>
                    < ASP:参数名称=DoctorIDTYPE =的Int32/>
                    < ASP:参数名称=时间戳TYPE =字节>< / ASP:参数>
                < / InsertParameters>
                < SelectParameters>
                    < ASP:ControlParameter控件ID =DropDownList1NAME =DoctorID属性名=的SelectedValueTYPE =的Int32默认值=0/>
                < / SelectParameters>
                < UpdateParameters>
                    < ASP:参数名称=ID类型=的Int32/>
                    < ASP:参数名称=OHIP类型=字符串/>
                    < ASP:参数名称=名字类型=字符串/>
                    < ASP:参数名称=姓氏类型=字符串/>
                    < ASP:参数的DbType =日期NAME =DOB/>
                    < ASP:参数名称=VisitsPerYearTYPE =的Int32/>
                    < ASP:参数名称=DoctorIDTYPE =的Int32/>
                    < ASP:参数名称=ID类型=的Int32/>
                    < ASP:参数名称=时间戳TYPE =字节>< / ASP:参数>
                < / UpdateParameters>
            < / ASP:SqlDataSource的>
            < P>选择病人由医生:< ASP:DropDownList的ID =DropDownList1=服务器的AutoPostBack =真的DataSourceID =sdDoctorListDataTextField =博士DataValueField =IDAppendDataBoundItems =真&GT ;
                < ASP:ListItem的值=0>所有的医生和LT; / ASP:ListItem的>
                < / ASP:DropDownList的>
            < ASP:GridView控件ID =GridView1=服务器AllowSorting =真的AutoGenerateColumns =FALSE背景色=白BORDERCOLOR =#336666边框=双边框宽度=的3px的cellpadding =4 的DataSourceID =sdPatient网格=水平>
                    <柱体和GT;
                        < ASP:CommandField中的ShowDeleteButton =真ShowEditButton =真/>
                        < ASP:的TemplateField的HeaderText =OHIPSORTEX pression =OHIP>
                            <&EditItemTemplate的GT;
                                < ASP:文本框ID =TextBox1的=服务器文本='<%#绑定(OHIP)%>'>< / ASP:文本框>
                            < / EditItemTemplate中>
                            <&ItemTemplate中GT;
                                < ASP:标签ID =Label1的=服务器文本='<%#绑定(OHIP)%>'>< / ASP:标签>
                            < / ItemTemplate中>
                        < / ASP:的TemplateField>
                        < ASP:的TemplateField的HeaderText =名SORTEX pression =名字>
                            <&EditItemTemplate的GT;
                                < ASP:文本框ID =TextBox2中=服务器文本='<%#绑定(名字)%>'>< / ASP:文本框>
                            < / EditItemTemplate中>
                            <&ItemTemplate中GT;
                                < ASP:标签ID =Label2的=服务器文本='<%#绑定(名字)%>'>< / ASP:标签>
                            < / ItemTemplate中>
                        < / ASP:的TemplateField>
                        < ASP:的TemplateField的HeaderText =姓SORTEX pression =姓氏>
                            <&EditItemTemplate的GT;
                                < ASP:文本框ID =TextBox3=服务器文本='<%#绑定(姓氏)%>'>< / ASP:文本框>
                            < / EditItemTemplate中>
                            <&ItemTemplate中GT;
                                < ASP:标签ID =LABEL3=服务器文本='<%#绑定(姓氏)%>'>< / ASP:标签>
                            < / ItemTemplate中>
                        < / ASP:的TemplateField>
                        < ASP:的TemplateField的HeaderText =DOBSORTEX pression =DOB>
                            <&EditItemTemplate的GT;
                                < ASP:文本框ID =TextBox4=服务器文本='<%#绑定(DOB)%>'>< / ASP:文本框>
                            < / EditItemTemplate中>
                            <&ItemTemplate中GT;
                                < ASP:标签ID =Label4=服务器文本='<%#绑定(DOB)%>'>< / ASP:标签>
                            < / ItemTemplate中>
                        < / ASP:的TemplateField>
                        < ASP:的TemplateField的HeaderText =访问,每年SORTEX pression =VisitsPerYear>
                            <&EditItemTemplate的GT;
                                < ASP:文本框ID =TextBox5=服务器文本='<%#绑定(VisitsPerYear)%>'>< / ASP:文本框>
                            < / EditItemTemplate中>
                            <&ItemTemplate中GT;
                                < ASP:标签ID =Label5=服务器文本='<%#绑定(VisitsPerYear)%>'>< / ASP:标签>
                            < / ItemTemplate中>
                        < / ASP:的TemplateField>
                        < ASP:的TemplateField的HeaderText =博士SORTEX pression =医生>
                            <&EditItemTemplate的GT;
                                < ASP:DropDownList的ID =DropDownList2=服务器的DataSourceID =sdDoctorListDataTextField =博士DataValueField =ID的SelectedValue ='<%#绑定(医生)%>'>
                                < / ASP:DropDownList的>
                            < / EditItemTemplate中>
                            <&ItemTemplate中GT;
                                < ASP:标签ID =Label6=服务器文本='<%#绑定(医生)%GT;'>< / ASP:标签>
                            < / ItemTemplate中>
                        < / ASP:的TemplateField>
                    < /专栏>
                    < FooterStyle背景色=白前景色=#333333/>
                    < HeaderStyle背景色=#336666FONT-粗体=真前景色=白/>
                    < PagerStyle背景色=#336666前景色=白Horizo​​ntalAlign =中心/>
                    < RowStyle背景色=白前景色=#333333/>
                    < SelectedRowStyle背景色=#339966FONT-粗体=真前景色=白/>
                    < SortedAscendingCellStyle背景色=#F7F7F7/>
                    < SortedAscendingHeaderStyle背景色=#487575/>
                    < SortedDescendingCellStyle背景色=#E5E5E5/>
                    < SortedDescendingHeaderStyle背景色=#275353/>
                < / ASP:GridView的>

办法:

这是dropdownlists。这给出的名称以及值。 *注:此过程适用于第一个DropDownList,我想为第二个至

  ALTER PROCEDURE dbo.uspDoctorList

开始
    SET NOCOUNT ON
    SELECT ID,姓氏+,+名字AS'医生'
    从医生
    ORDER BY医生
结束

这是更新过程。不知道这是一个过错与否,或者如果它只是我的ASP

  ALTER PROCEDURE dbo.uspPatientUpdate
    @ID INT,
    @OHIP CHAR(10)
    @firstName为nvarchar(20),
    @LastName为nvarchar(40),
    @DOB日期,
    @VisitsPerYear INT,
    @DoctorID INT,
    @timestamp时间戳如
开始
    SET NOCOUNT OFF
    更新病人
    SET OHIP = @OHIP,
      名字= @firstName,
      姓氏= @LastName,
      DOB = @DOB,
      VisitsPerYear = @VisitsPerYear,
      DoctorID = @DoctorID
    WHERE ID = @ID和时间戳= @timestamp
结束

我将AP preciate任何帮助。 BTW这个东西是多一点进步,我们被教导又是什么(使用ASP存储过程),我要为加分额外的努力..在此先感谢。

如果您需要任何更多的信息,请咨询


解决方案

问题1 - 在GridView控件更新数据

1)正如安德烈指出你的第一个问题是,ID是列出了两次< UpdateParameters方式> ,删除其中一个

2)从参数列表中删除时间戳,时间戳会自动更新

 < UpdateParameters>
        < ASP:参数名称=ID类型=的Int32/>
        < ASP:参数名称=OHIP类型=字符串/>
        < ASP:参数名称=名字类型=字符串/>
        < ASP:参数名称=姓氏类型=字符串/>
        < ASP:参数名称=DOB的DbType =日期时间/>
        < ASP:参数名称=VisitsPerYearTYPE =的Int32/>
        < ASP:参数名称=DoctorIDTYPE =的Int32/>
    < / UpdateParameters>

注意:如果您需要保存的日期时间戳,在SQL改变的时间戳的的数据类型列datetime和改变存储的更新步骤, - Patient.Timestamp = GETDATE()

3)从更新存储过程删除@timestamp(包括作为参数,并在WHERE子句中)

4)在GridView集的标记的DataKeyNames =ID这就是非常重要,使用的的DataKeyNames 属性来指定重新presents领域数据源的主键,它必须在为了使自动更新设置和删除GridView控件来工作的特征:

 < ASP:GridView控件
            ID =GridView1
            的DataKeyNames =ID

一旦你完成了上述所有的更新会的工作,我已经创建使用SQL Server防爆preSS 2008和ASP.NET 4.0为你一个示例项目,你可以找到它的此处谷歌驱动器(只需点击文件 - >下载获得the.zip项目)

问题2 - 插入数据并刷新GridView的

1)更改< InsertParameters> 得到的控制(IM显示只有四个参数的例子,你可以改变这个数据需要)

 < InsertParameters>
    < ASP:ControlParameter控件ID =txtOhipNAME =OHIP/>
    < ASP:ControlParameter控件ID =txtFirstNameNAME =名字/>
    < ASP:ControlParameter控件ID =txtLastNameNAME =姓氏/>
    < ASP:ControlParameter控件ID =ddlDoctorIdNAME =DoctorID属性名=的SelectedValue/>
< / InsertParameters>

2)添加控件插入到页面并调用您的SQL数据源的插入()方法,当用户单击Add按钮:

 <表>
    &所述; TR>
        &所述; TD>
            OHIP
        < / TD>
        &所述; TD>
            < ASP:文本框ID =txtOhip=服务器>< / ASP:文本框>
        < / TD>
    < / TR>
    &所述; TR>
        &所述; TD>
            名字
        < / TD>
        &所述; TD>
            < ASP:文本框ID =txtFirstName=服务器>< / ASP:文本框>
        < / TD>
    < / TR>
    &所述; TR>
        &所述; TD>
            姓
        < / TD>
        &所述; TD>
            < ASP:文本框ID =txtLastName=服务器>< / ASP:文本框>
        < / TD>
    < / TR>
    &所述; TR>
        &所述; TD>
            医生
        < / TD>
        &所述; TD>
            :LT; ASP:DropDownList的ID =ddlDoctorId=服务器的AutoPostBack =真的DataSourceID =sdDoctorList
                DataTextField =博士DataValueField =DoctorIDAppendDataBoundItems =真>
                < ASP:ListItem的值=0>所有的医生和LT; / ASP:ListItem的>
            < / ASP:DropDownList的>
        < / TD>
    < / TR>
    &所述; TR>
        < TD风格=文本对齐:对合并单元格=2>
            < ASP:按钮的ID =btnAdd的OnClick =添加=服务器文本=添加/>
        < / TD>
    < / TR>
< /表>
<脚本=服务器>
保护无效添加(对象发件人,EventArgs的发送)
    {
        sdPatient.Insert();
    }
< / SCRIPT>

I am a noob at ASP.NET/C#, but I'll do my best to describe my problem as best as I can.

Now I have a gridview that has a sql source attached to it; It grabs the correct information. The gridview's information will change depending on what is selected in a dropdown list that is outside of the grid, which works. The problem lies within updating and inserting.

Once attempting to update. (AS soon as I click edit on one of the columns) I get the following error message: 'DropDownList2' has a SelectedValue which is invalid because it does not exist in the list of items. Parameter name: value

I split the columns into templates, as seen below,so I can manage them easier. 'Dropdown list 2' is located in my edit template. It is connected to a datasource; that being the exact same source as my first dropdownmenu which works flawlessly. So I don't believe it would be the sql behind that procedure. I do however have this dropdownlist 2 bound to Doctor. Now I was told to bound it, so I do not know how binding works

If I unbind it, I can at least see the grid still after I click edit, but after I update I get the error message: Procedure or function uspPatientUpdate has too many arguments specified.

Now I've looked online for a solution, but I can't wrap my head around binding. I'll give the following code as necessary.

ASP:

<asp:SqlDataSource ID="sdPatient" runat="server" ConnectionString="<%$ ConnectionStrings:MedicalOfficeConnectionString %>" DeleteCommand="usp_PatientDelete" InsertCommand="uspPatientInsert" SelectCommand="uspPatientSelectByIDOrSelectAll" UpdateCommand="uspPatientUpdate" SelectCommandType="StoredProcedure" DeleteCommandType="StoredProcedure" InsertCommandType="StoredProcedure" UpdateCommandType="StoredProcedure">
                <DeleteParameters>
                    <asp:Parameter Name="ID" Type="Int32" />
                </DeleteParameters>
                <InsertParameters>
                    <asp:Parameter Name="OHIP" Type="String" />
                    <asp:Parameter Name="FirstName" Type="String" />
                    <asp:Parameter Name="LastName" Type="String" />
                    <asp:Parameter DbType="Date" Name="DOB" />
                    <asp:Parameter Name="VisitsPerYear" Type="Int32" />
                    <asp:Parameter Name="DoctorID" Type="Int32" />
                    <asp:Parameter Name="Timestamp" Type="Byte"></asp:Parameter>
                </InsertParameters>
                <SelectParameters>
                    <asp:ControlParameter ControlID="DropDownList1" Name="DoctorID" PropertyName="SelectedValue" Type="Int32" DefaultValue="0" />
                </SelectParameters>
                <UpdateParameters>
                    <asp:Parameter Name="ID" Type="Int32" />
                    <asp:Parameter Name="OHIP" Type="String" />
                    <asp:Parameter Name="FirstName" Type="String" />
                    <asp:Parameter Name="LastName" Type="String" />
                    <asp:Parameter DbType="Date" Name="DOB" />
                    <asp:Parameter Name="VisitsPerYear" Type="Int32" />
                    <asp:Parameter Name="DoctorID" Type="Int32" />
                    <asp:Parameter Name="ID" Type="Int32" />
                    <asp:Parameter Name="Timestamp" Type="Byte"></asp:Parameter>
                </UpdateParameters>
            </asp:SqlDataSource>
            <p>Select Patient By Doctor:<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" DataSourceID="sdDoctorList" DataTextField="Doctor" DataValueField="ID" AppendDataBoundItems="True">
                <asp:ListItem Value="0">All Doctors</asp:ListItem>
                </asp:DropDownList>
            <asp:GridView ID="GridView1" runat="server" AllowSorting="True" AutoGenerateColumns="False" BackColor="White" BorderColor="#336666" BorderStyle="Double" BorderWidth="3px" CellPadding="4" DataSourceID="sdPatient" GridLines="Horizontal">
                    <Columns>
                        <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
                        <asp:TemplateField HeaderText="OHIP" SortExpression="OHIP">
                            <EditItemTemplate>
                                <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("OHIP") %>'></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="Label1" runat="server" Text='<%# Bind("OHIP") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="First Name" SortExpression="FirstName">
                            <EditItemTemplate>
                                <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("FirstName") %>'></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="Label2" runat="server" Text='<%# Bind("FirstName") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Last Name" SortExpression="LastName">
                            <EditItemTemplate>
                                <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("LastName") %>'></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="Label3" runat="server" Text='<%# Bind("LastName") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="DOB" SortExpression="DOB">
                            <EditItemTemplate>
                                <asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("DOB") %>'></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="Label4" runat="server" Text='<%# Bind("DOB") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Visits Per Year" SortExpression="VisitsPerYear">
                            <EditItemTemplate>
                                <asp:TextBox ID="TextBox5" runat="server" Text='<%# Bind("VisitsPerYear") %>'></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="Label5" runat="server" Text='<%# Bind("VisitsPerYear") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Doctor" SortExpression="Doctor">
                            <EditItemTemplate>
                                <asp:DropDownList ID="DropDownList2" runat="server" DataSourceID="sdDoctorList" DataTextField="Doctor" DataValueField="ID"  SelectedValue='<%# Bind("Doctor") %>'>
                                </asp:DropDownList>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="Label6" runat="server" Text='<%# Bind("Doctor") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <FooterStyle BackColor="White" ForeColor="#333333" />
                    <HeaderStyle BackColor="#336666" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="#336666" ForeColor="White" HorizontalAlign="Center" />
                    <RowStyle BackColor="White" ForeColor="#333333" />
                    <SelectedRowStyle BackColor="#339966" Font-Bold="True" ForeColor="White" />
                    <SortedAscendingCellStyle BackColor="#F7F7F7" />
                    <SortedAscendingHeaderStyle BackColor="#487575" />
                    <SortedDescendingCellStyle BackColor="#E5E5E5" />
                    <SortedDescendingHeaderStyle BackColor="#275353" />
                </asp:GridView>

Procedures:

This is for the dropdownlists. This gives the name as well as the value. *Note: This procedure works for the first dropdownlist, and I suppose for the second one to.

ALTER PROCEDURE dbo.uspDoctorList
AS
BEGIN
    SET NOCOUNT ON
    SELECT     ID, LastName +', ' + FirstName AS 'Doctor'
    FROM         Doctor
    ORDER BY 'Doctor'
END

This is the update procedure. Not sure if this is the one at fault or not, or if it is just my ASP

ALTER PROCEDURE dbo.uspPatientUpdate
    @ID int,
    @OHIP char(10),
    @FirstName nvarchar(20),
    @LastName nvarchar(40),
    @DOB date,
    @VisitsPerYear int,
    @DoctorID int,
    @Timestamp Timestamp

AS
BEGIN
    SET NOCOUNT OFF
    UPDATE Patient
    SET OHIP = @OHIP,
      FirstName = @FirstName, 
      LastName = @LastName,
      DOB = @DOB,
      VisitsPerYear = @VisitsPerYear,
      DoctorID = @DoctorID
    WHERE ID = @ID AND Timestamp = @Timestamp
END

I'll appreciate any help. BTW this stuff is a little more advance then what we were taught (using stored procedures in ASP), I'm going the extra mile for bonus marks.. Thanks in advance.

If you need any more information, please ask

解决方案

Question 1 - Update data in gridview

1) As pointed out by Andriy your first problem is that the ID is listed twice in <UpdateParameters>,remove one of them.

2) Remove Timestamp from the list of parameters, timestamps are updated automatically

    <UpdateParameters>
        <asp:Parameter Name="ID" Type="Int32" />
        <asp:Parameter Name="OHIP" Type="String" />
        <asp:Parameter Name="FirstName" Type="String" />
        <asp:Parameter Name="LastName" Type="String" />
        <asp:Parameter Name="DOB" DbType="DateTime" />
        <asp:Parameter Name="VisitsPerYear" Type="Int32" />
        <asp:Parameter Name="DoctorID" Type="Int32" />
    </UpdateParameters>

NOTE: If you need to save date timestamps, in SQL change the datatype of the Timestamp column to datetime and change the Update stored procedure as - Patient.Timestamp = GETDATE()

3) Remove @Timestamp from the update stored procedure(both as a parameter and from the WHERE clause)

4) In the markup of the gridview set DataKeyNames="ID" this is very important, Use DataKeyNames property to specify the field that represents the primary key of the data source, it must be set in order for the automatic update and delete features of the GridView control to work:

<asp:GridView
            ID="GridView1"
            DataKeyNames="ID"

Once you've done all of the above your updates will work, I've created a sample project for you using SQL Server Express 2008 and ASP.NET 4.0, you can find it here on Google drive (Just click on File -> Download to get the.zip project)

Question 2 - Insert data and refresh in gridview

1) Change <InsertParameters> to get data from controls (Im showing an example with only four parameters, you can change this as needed)

<InsertParameters>
    <asp:ControlParameter ControlID="txtOhip" Name="OHIP" />
    <asp:ControlParameter ControlID="txtFirstName" Name="FirstName" />
    <asp:ControlParameter ControlID="txtLastName" Name="LastName" />
    <asp:ControlParameter ControlID="ddlDoctorId" Name="DoctorID" PropertyName="SelectedValue" />
</InsertParameters> 

2)Add insert controls to the page and call the Insert() method of your sql data source when the user clicks the add button:

<table>
    <tr>
        <td>
            OHIP
        </td>
        <td>
            <asp:TextBox ID="txtOhip" runat="server"></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td>
            First name
        </td>
        <td>
            <asp:TextBox ID="txtFirstName" runat="server"></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td>
            Last name
        </td>
        <td>
            <asp:TextBox ID="txtLastName" runat="server"></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td>
            Doctor
        </td>
        <td>
            :<asp:DropDownList ID="ddlDoctorId" runat="server" AutoPostBack="True" DataSourceID="sdDoctorList"
                DataTextField="Doctor" DataValueField="DoctorID" AppendDataBoundItems="True">
                <asp:ListItem Value="0">All Doctors</asp:ListItem>
            </asp:DropDownList>
        </td>
    </tr>
    <tr>
        <td style="text-align: right" colspan="2">
            <asp:Button ID="btnAdd" OnClick="Add" runat="server" Text="Add" />
        </td>
    </tr>
</table>
<script runat="server">
protected void Add(object sender,EventArgs e)
    {
        sdPatient.Insert();
    } 
</script>

这篇关于问题与插入和更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆