运行ASP.NET网站时出现错误的SQL错误

时间:2019-07-15 18:41:14

标签: asp.net vb.net

好的,所以我正在建立一个ASP.NET网站,当前正在创建登录表单,但是我一直收到一个错误,提示我无法附加SQL Server文件。

我做了一些研究,发现我需要在我的目录中创建一个app_data文件夹,现在在该文件夹中有3个.mdf文件(SQL Server主数据文件),无法在SQL Server Management Studio中打开。

类似的问题可以通过修复与SQL Server的连接来解决。但是,在我的网站上,我没有与声明的SQL Server的连接,那么为什么会出现SQL Server错误?还要附加被调用的功能

Protected Sub Login1(sender As Object, e As System.EventArgs) Handles loginForm.LoggingIn
    Dim bolloginCheck As Boolean
    ScriptManager.RegisterStartupScript(Me, Me.GetType(), "alertMessage", "alert(' " & loginForm.UserName.Trim() & " - " & loginForm.Password.Trim() & " ');", True)  'displays localhostsays : called fomrcode-behind directly!
    bolloginCheck = _client.Verify_Login(loginForm.UserName, loginForm.Password)
    If bolloginCheck = True Then
        'set user name Or session variable, adjust to true And authenticated
        Response.Redirect("https://www.google.com")
    Else
        loginForm.FailureText = "Unable to login, please review your login credentials."
    End If
End Sub

    Public Function Verify_Login(strUsername As String, strPassword As String) As Boolean Implements IService.Verify_Login
        Return True
    End Function

<ServiceContract()>
Public Interface IService
    ''WEBSITE FUNCTIONS''
    <OperationContract()>
    Function Verify_Login(uname As String, pword As String) As Boolean
End Interface
<DataContract()>
Public Class CompositeType
    <DataMember()>
    Public Property BoolValue() As Boolean
    <DataMember()>
    Public Property StringValue() As String
End Class

Public Class Service
    Implements IService
    Public Sub New()

    End Sub

    Public Function Verify_Login(strUsername As String, strPassword As String) As Boolean Implements IService.Verify_Login
        Return True
    End Function
End Class

错误:

  

尝试为文件C:\ Users \ Dewy \ Desktop \ TestWebSite \ App_Data \ aspnetdb.mdf附加自动命名的数据库失败。存在具有相同名称的数据库,或者无法打开指定的文件,或者该文件位于UNC共享上。

0 个答案:

没有答案