ChangePassword Control中此版本的SQL Server错误不支持用户实例登录标志

时间:2015-04-02 05:16:54

标签: c# sql asp.net sql-server

我使用ChangePassword ASP.NET Control创建了一个空页面。 此页面没有任何代码隐藏。但是当我使用此控件时,它会显示此错误。

  

此版本的SQL不支持用户实例登录标志   服务器。连接将被关闭。

这是我的ASPX页面

<asp:ChangePassword ID="ChangePassword1" runat="server" 
     BackColor="#F5F7F9"  
     style="margin-left:auto;margin-right:auto;margin-top:150px;"
     BorderColor="#CCCC99" BorderStyle="Solid" BorderWidth="1px" 
     Font-Names="Arial" Font-Size="9pt" Height="281px" 
     onchangedpassword="ChangePassword1_ChangedPassword" Width="444px" 
     onchangingpassword="ChangePassword1_ChangingPassword" 
     oncontinuebuttonclick="ChangePassword1_ContinueButtonClick">
<CancelButtonStyle CssClass="button" Height="24px" Width="100px" />
<ChangePasswordButtonStyle CssClass="button" Height="24px" Width="150px" />
<ChangePasswordTemplate>
    <table cellpadding="1" cellspacing="0" style="border-collapse:collapse;">
        <tr>
            <td>
                <table cellpadding="0" style="height:281px;width:444px;">
                    <tr>
                        <td align="center" colspan="2" 
                            style="color:White;background-color:#8B9ACB;font-weight:bold;">
                            Change Your Password</td>
                    </tr>
                    <tr>
                    <td colspan="2" style= "height:20px;"></td>
                    </tr>
                    <tr>
                        <td align="right" width="180px"> 
                            <asp:Label ID="CurrentPasswordLabel" runat="server" 
                                AssociatedControlID="CurrentPassword">Password:</asp:Label>
                        </td>
                        <td>
                            <asp:TextBox ID="CurrentPassword" runat="server" TextMode="Password" 
                                Width="230px"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="CurrentPasswordRequired" runat="server" 
                                ControlToValidate="CurrentPassword" ErrorMessage="Password is required." 
                                ToolTip="Password is required." ValidationGroup="ChangePassword1">*</asp:RequiredFieldValidator>
                        </td>
                    </tr>
                    <tr>
                        <td align="right">
                            <asp:Label ID="NewPasswordLabel" runat="server" 
                                AssociatedControlID="NewPassword">New Password:</asp:Label>
                        </td>
                        <td>
                            <asp:TextBox ID="NewPassword" runat="server" TextMode="Password" Width="230px"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="NewPasswordRequired" runat="server" 
                                ControlToValidate="NewPassword" ErrorMessage="New Password is required." 
                                ToolTip="New Password is required." ValidationGroup="ChangePassword1">*</asp:RequiredFieldValidator>
                        </td>
                    </tr>
                    <tr>
                        <td align="right">
                            <asp:Label ID="ConfirmNewPasswordLabel" runat="server" 
                                AssociatedControlID="ConfirmNewPassword">Confirm New Password:</asp:Label>
                        </td>
                        <td>
                            <asp:TextBox ID="ConfirmNewPassword" runat="server" TextMode="Password" 
                                Width="230px"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="ConfirmNewPasswordRequired" runat="server" 
                                ControlToValidate="ConfirmNewPassword" 
                                ErrorMessage="Confirm New Password is required." 
                                ToolTip="Confirm New Password is required." ValidationGroup="ChangePassword1">*</asp:RequiredFieldValidator>
                        </td>
                    </tr>
                    <tr>
                        <td align="center" colspan="2">
                            <asp:CompareValidator ID="NewPasswordCompare" runat="server" 
                                ControlToCompare="NewPassword" ControlToValidate="ConfirmNewPassword" 
                                Display="Dynamic" 
                                ErrorMessage="The Confirm New Password must match the New Password entry." 
                                ValidationGroup="ChangePassword1"></asp:CompareValidator>
                        </td>
                    </tr>
                    <tr>
                        <td align="center" colspan="2" style="color:Red;">
                            <asp:Literal ID="FailureText" runat="server" EnableViewState="False"></asp:Literal>
                        </td>
                    </tr>
                    <tr>
                        <td align="right">

                        </td>
                        <td>
                         <asp:Button ID="ChangePasswordPushButton" runat="server" 
                                CommandName="ChangePassword" CssClass="button" Height="24px" 
                                Text="Change Password" ValidationGroup="ChangePassword1" Width="120px" />
                            <asp:Button ID="CancelPushButton" runat="server" CausesValidation="False" 
                                CommandName="Cancel" CssClass="button" Height="24px" Text="Cancel" style="margin-left:10px;"
                                Width="100px" />
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</ChangePasswordTemplate>
<TitleTextStyle BackColor="#8B9ACB" Font-Bold="True" ForeColor="#FFFFFF" />

而且,这是背后的代码

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;


namespace IgnisAccess
{
    public partial class UserProfile : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void ChangePassword1_ChangedPassword(object sender, EventArgs e)
        {


        }

        protected void ChangePassword1_ChangingPassword(object sender, LoginCancelEventArgs e)
        {

        }

        protected void ChangePassword1_ContinueButtonClick(object sender, EventArgs e)
        {

        }
    }
}

1 个答案:

答案 0 :(得分:1)

您需要检查数据库连接字符串 - 看起来您正在某处使用UserInstance=true

SQL Server Express 上仅支持 这个标志 - 所以如果您使用的是任何其他版本的SQL Server,则需要更改