从文本框到sql数据库的数据

时间:2022-11-29 17:24:28

Code for my modal table that needs to be placed in sql database. i need these textboxes to be placed into my database but I am unsure of the plumbing to do so. I just need the textboxes from this modal to import the data into my database.

我的模态表的代码,需要放在sql数据库中。我需要将这些文本框放到我的数据库中,但我不确定是否应该这样做。我只需要这个模式的文本框将数据导入到数据库中。

<div id="AddInfo" style="display: none;">
        <table>
            <tr>
                <td>
                    <asp:Label ID="lblId" runat="server" Text="ID" Height="16px" Width="135px"></asp:Label>
                    <asp:Label ID="lblLastName" runat="server" Text="Last Name" Height="16px" Width="129px"></asp:Label>
                    <asp:Label ID="lblFirstName" runat="server" Text="First Name" Height="16px" Width="134px"></asp:Label>
                    <asp:Label ID="lblMiddleName" runat="server" Text="Middle Name" Height="16px" Width="131px"></asp:Label>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:TextBox ID="tbID" runat="server" Height="16px" Width="125px"></asp:TextBox>
                    <asp:TextBox ID="tbLastName" runat="server" Height="16px" Width="125px"></asp:TextBox>
                    <asp:TextBox ID="tbFirstName" runat="server" Height="16px" Width="125px"></asp:TextBox>
                    <asp:TextBox ID="tbMiddleName" runat="server" Height="16px" Width="125px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="lblTitle" runat="server" Text="Title" Height="16px" Width="134px"></asp:Label>
                    <asp:Label ID="lblSSN" runat="server" Text="SSN" Height="16px" Width="125px"></asp:Label>
                    <asp:Label ID="lblDOB" runat="server" Text="DOB" Height="16px" Width="134px"></asp:Label>
                    <asp:Label ID="lblHireDate" runat="server" Text="Hire Date" Height="16px" Width="131px"></asp:Label>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:TextBox ID="tbTitle" runat="server" Height="16px" Width="125px"></asp:TextBox>
                    <asp:TextBox ID="tbSSN" runat="server" Height="16px" Width="125px"></asp:TextBox>
                    <asp:TextBox ID="tbDOB" runat="server" Height="16px" Width="125px"></asp:TextBox>
                    <asp:TextBox ID="tbHireDate" runat="server" Height="16px" Width="125px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="lblAddress" runat="server" Text="Address" Height="16px" Width="132px"></asp:Label>
                    <asp:Label ID="lblCity" runat="server" Text="City" Height="16px" Width="132px"></asp:Label>
                    <asp:Label ID="lblState" runat="server" Text="State" Height="16px" Width="133px"></asp:Label>
                    <asp:Label ID="lblZip" runat="server" Text="Zip" Height="16px" Width="125px"></asp:Label>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:TextBox ID="tbAddress" runat="server" Height="16px" Width="125px"></asp:TextBox>
                    <asp:TextBox ID="tbCity" runat="server" Height="16px" Width="125px"></asp:TextBox>
                    <asp:TextBox ID="tbState" runat="server" Height="16px" Width="125px"></asp:TextBox>
                    <asp:TextBox ID="tbZip" runat="server" Height="16px" Width="125px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    <br />
                    <asp:Button ID="btnCancelNew" runat="server" Text="Cancel" Font-Size="X-Small" />
                </td>
            </tr>
        </table>

Here is my sql data base that is populating the gridview on page. It is just sorting data by facility.

这是我在页面上填充gridview的sql数据库。它只是按设备对数据进行排序。

private void BindGrid()
{
    //set up arguments for the stored proc
    int? FacilityID = (ddlFacility2.SelectedValue.Equals("-1")) ? (int?)null : int.Parse(ddlFacility2.SelectedValue);
    int? OtherDataID = null;

    //bind
    GvReportResults.DataSource = this.DataLayer.model.MS_spGetOtherData(FacilityID, OtherDataID);
    GvReportResults.DataBind();
}

private void ResetForm()
{
    try
    {
        //facility dropdown
        ddlFacility2.Items.Clear();
        ddlFacility2.DataSource = this.DataLayer.model.MS_spGetFacilityInfo(null).OrderBy(x => x.FacilityName);
        ddlFacility2.DataTextField = "FacilityName";
        ddlFacility2.DataValueField = "FacilityID";
        ddlFacility2.DataBind();
        ddlFacility2.Items.Insert(0, new ListItem("All Facility Records..", "-1"));

        BindGrid();

    }
    catch (Exception ex)
    {
        this.SetMessage(ex.ToString(), PageMessageType.Error);
        AISLogger.WriteException(ex);
    }
}

1 个解决方案

#1


0  

try this link it explains the basics of Sql server and what you need to do in order to insert http://www.w3schools.com/sql/sql_insert.asp

试试这个链接,它解释了Sql server的基本原理,以及插入http://www.w3schools.com/sql/sql_insert.asp需要做什么

#1


0  

try this link it explains the basics of Sql server and what you need to do in order to insert http://www.w3schools.com/sql/sql_insert.asp

试试这个链接,它解释了Sql server的基本原理,以及插入http://www.w3schools.com/sql/sql_insert.asp需要做什么