2016-05-22 87 views
0

我是ASP.Net的新手,我的Language="C#"。 我想知道如何將以下代碼保存到mysql數據庫。ASP.Net連接到SQL數據庫

<%@ Page Title="Register" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Register.aspx.cs" Inherits="BTC_LunarGamble.Account.Register" %> 

<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent"> 
    <h2><%: Title %>.</h2> 
    <p class="text-danger"> 
     <asp:Literal runat="server" ID="ErrorMessage" /> 
    </p> 

    <div class="form-horizontal"> 
     <h4>Create a new account</h4> 
     <h4>Your BTC Address will be your Username.</h4> 
     <hr /> 
     <asp:ValidationSummary runat="server" CssClass="text-danger" /> 
     <div class="form-group"> 
      <asp:Label runat="server" AssociatedControlID="Email" CssClass="col-md-2 control-label">Email</asp:Label> 
      <div class="col-md-10"> 
       <asp:TextBox runat="server" ID="Email" CssClass="form-control" TextMode="Email" /> 
       <asp:RequiredFieldValidator runat="server" ControlToValidate="Email" 
        CssClass="text-danger" ErrorMessage="The email field is required." /> 
      </div> 
     </div> 
     <div class="form-group"> 
      <asp:Label runat="server" AssociatedControlID="Password" CssClass="col-md-2 control-label">Password</asp:Label> 
      <div class="col-md-10"> 
       <asp:TextBox runat="server" ID="Password" TextMode="Password" CssClass="form-control" /> 
       <asp:RequiredFieldValidator runat="server" ControlToValidate="Password" 
        CssClass="text-danger" ErrorMessage="The password field is required." /> 
      </div> 
     </div> 
     <div class="form-group"> 
      <asp:Label runat="server" AssociatedControlID="ConfirmPassword" CssClass="col-md-2 control-label">Confirm password</asp:Label> 
      <div class="col-md-10"> 
       <asp:TextBox runat="server" ID="ConfirmPassword" TextMode="Password" CssClass="form-control" /> 
       <asp:RequiredFieldValidator runat="server" ControlToValidate="ConfirmPassword" 
        CssClass="text-danger" Display="Dynamic" ErrorMessage="The confirm password field is required." /> 
       <asp:CompareValidator runat="server" ControlToCompare="Password" ControlToValidate="ConfirmPassword" 
        CssClass="text-danger" Display="Dynamic" ErrorMessage="The password and confirmation password do not match." /> 
      </div> 
     </div> 
     <div class="form-group"> 
      <div class="col-md-offset-2 col-md-10"> 
       <asp:Button runat="server" OnClick="CreateUser_Click" Text="Register" CssClass="btn btn-default" /> 
      </div> 
     </div> 
    </div> 
</asp:Content> 

所以我有一個MySQL數據庫,我想知道如何將以下文本框(電子郵件,密碼)保存到MySQL數據庫?預先感謝您:)

(文本框包括:電子郵件,密碼,確認密碼)

+0

這是一個廣泛的問題。你需要從ADO.NET開始。這裏是https://msdn.microsoft.com/en-us/library/aa302325.aspx – Rahul

回答