hi,
there , i am coming up with a login page and i am getting error on the codes... please help.

<script runat="server">

    Sub OnLoginError(ByVal sender As Object, ByVal e As EventArgs)
        Login1.PasswordRecoveryText = "Forgot your password?"
    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim Oconn As New OleDBConnection
        Dim sConnString As String

        'change Data Source=<GOPI\SQLEXPRESS>, Initial Catalog =<DatabaseName>, user Id and password
        sConnString = "Provider=SQLOLEDB;Data Source=AGUSTTIN\SQLEXPRESS;Initial Catalog=test;User ID=sa;Password=jamesbond"
        With Oconn
            .ConnectionString = sConnString
            .Open()
            Response.Write(.Provider & "<br>")
            Response.Write(.DataSource & "<br>")
            .Close()
        End With
        
    End Sub

    Protected Sub Login1_Authenticate(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.AuthenticateEventArgs)

    End Sub
</script>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <br />
    <br />
    <br />
    <asp:Login ID="Login1" runat="server" Height="58px" BackColor="#F7F7DE" BorderColor="#CCCC99" BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="10pt" OnAuthenticate="Login1_Authenticate">
        <TitleTextStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
        <LayoutTemplate>
            <table border="0" cellpadding="1" cellspacing="0" style="border-collapse: collapse;
                height: 150px">
                <tr>
                    <td>
                        <table border="0" cellpadding="0" style="height: 58px">
                            <tr>
                                <td align="center" colspan="2" style="font-weight: bold; color: white; background-color: #6b696b">
                                    Log In</td>
                                <td align="center" colspan="1" style="font-weight: bold; color: white; background-color: #6b696b">
                                </td>
                            </tr>
                            <tr>
                                <td align="right">
                                    <asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">User Name:</asp:Label></td>
                                <td>
                                    <asp:TextBox ID="UserName" runat="server"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName"
                                        ErrorMessage="User Name is required." ToolTip="User Name is required." ValidationGroup="Login1">*</asp:RequiredFieldValidator>
                                </td>
                                <td>
                                </td>
                            </tr>
                            <tr>
                                <td align="right">
                                    <asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password">Password:</asp:Label></td>
                                <td>
                                    <asp:TextBox ID="Password" runat="server" TextMode="Password"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password"
                                        ErrorMessage="Password is required." ToolTip="Password is required." ValidationGroup="Login1">*</asp:RequiredFieldValidator>
                                </td>
                                <td>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    <asp:CheckBox ID="RememberMe" runat="server" Text="Remember me next time." />
                                </td>
                                <td colspan="1">
                                </td>
                            </tr>
                            <tr>
                                <td align="center" colspan="2" style="color: red">
                                    <br />
                                    <asp:LinkButton ID="LbTNPassword" runat="server" PostBackUrl="~/Password Recovery.aspx">Forgot your password?</asp:LinkButton>&nbsp;</td>
                                <td align="center" colspan="1" style="color: red">
                                </td>
                            </tr>
                            <tr>
                                <td align="right" colspan="2">
                                    <br />
                                    <br />
                                    <asp:Button ID="LoginButton" runat="server" CommandName="Login" Text="Log In" ValidationGroup="Login1" />
                                </td>
                                <td align="right" colspan="1">
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
        </LayoutTemplate>
    </asp:Login>

I am getting an error on this part of the codes. It says 'login failed for user 'couriersystem'. the user is not associated with a trusted sql server.'

sConnString = "Provider=SQLOLEDB;Data Source=AGUSTTIN\SQLEXPRESS;Initial Catalog=CourierSystem;User ID=sa;Password=jamesbond"
Comments
Why you not learn something about BB code tag

i changed it and it says 'invalid value for key 'integrated security' .

This statement shows at the '.Open()'

.ConnectionString = sConnString
.Open()

Open your visual studio and follow up these steps:

1. Click at View Menu + Server Explorer
2. Right click on Data Connections.
3. Select Add Connection
4. Click on Change to select Data source as "Microsoft Sql Sever" and Data Provider as ".NET Framework Data Provider For OLEDB"
5. Type Server Name .\SQLEXPRESS
6. At Connect to database : Select a database.
7. Click on OK
8. You may see the SQLOLEDB connection and now right click on it to select properties, where you can find the connection string.

Note: If above step fails then there is a problem with sql server.

This article has been dead for over six months. Start a new discussion instead.