DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    nani Guest

    Err on connection


    Hi,

    I'm having a problem when run my connection codes. My codes are as follows:

    strConn = "provider=SQLOLEDB;data source=localhost;initial catalog=pubs;"
    & _"integrated security=SSPI;persist security info=true;" & _
    "workstation id=localhost;UID=sa;packet size=4096"

    Dim strSQL As String
    Dim cn As New OleDbConnection(strConn)
    Dim da As New OleDbDataAdapter(strSQL, cn)
    Dim ds As New DataSet()

    cn.Open()

    strSQL = "select * from authors"
    da.Fill(ds, "authors")
    DataGrid1.DataSource = ds
    DataGrid1.DataBind()

    I've got the following error message upon compile

    System.Data.OleDb.OleDbException: Login failed for user 'ROSNAINI\ASPNET'.


  2. #2
    nani Guest

    Re: Err on connection


    "nani" <rosnaini@seccom.com.my> wrote:
    >
    >Hi,
    >
    >I'm having a problem when run my connection codes. My codes are as follows:
    >
    >strConn = "provider=SQLOLEDB;data source=localhost;initial catalog=pubs;"
    >& _"integrated security=SSPI;persist security info=true;" & _
    > "workstation id=localhost;UID=sa;packet size=4096"
    >
    > Dim strSQL As String
    > Dim cn As New OleDbConnection(strConn)
    > Dim da As New OleDbDataAdapter(strSQL, cn)
    > Dim ds As New DataSet()
    >
    > cn.Open()
    >
    > strSQL = "select * from authors"
    > da.Fill(ds, "authors")
    > DataGrid1.DataSource = ds
    > DataGrid1.DataBind()
    >
    >I've got the following error message upon compile
    >
    >System.Data.OleDb.OleDbException: Login failed for user 'ROSNAINI\ASPNET'.
    >

    Anybody knows why? Thanks

  3. #3
    Harish Mohanbabu Guest

    Re: Err on connection


    Nani,

    How did you formed the connection string? Try to create a UDL file and test
    it. Once you're convinced that it is working fine, copy the connection string
    and paste it. If you're not sure abt creating UDL file, please try to do
    the following:

    1. Go to Desktop and right click. Click on New and select Text Document.
    2. Save the text document with .UDL as the file extension (Ex: Test.UDL).
    3. Now you shd be able to see Test.UDL sitting on your desktop.
    4. Right click and select properties.
    5. Go to the connection tab and select the data source & user credentials

    and click on Test connection.
    6. Once it is working fine, click on OK. Right click on the file again.
    7. Select open with Text Pad and copy the connection string.

    HTH,
    Harish Mohanbabu

    "nani" <rosnaini@seccom.com.my> wrote:
    >
    >"nani" <rosnaini@seccom.com.my> wrote:
    >>
    >>Hi,
    >>
    >>I'm having a problem when run my connection codes. My codes are as follows:
    >>
    >>strConn = "provider=SQLOLEDB;data source=localhost;initial catalog=pubs;"
    >>& _"integrated security=SSPI;persist security info=true;" & _
    >> "workstation id=localhost;UID=sa;packet size=4096"
    >>
    >> Dim strSQL As String
    >> Dim cn As New OleDbConnection(strConn)
    >> Dim da As New OleDbDataAdapter(strSQL, cn)
    >> Dim ds As New DataSet()
    >>
    >> cn.Open()
    >>
    >> strSQL = "select * from authors"
    >> da.Fill(ds, "authors")
    >> DataGrid1.DataSource = ds
    >> DataGrid1.DataBind()
    >>
    >>I've got the following error message upon compile
    >>
    >>System.Data.OleDb.OleDbException: Login failed for user 'ROSNAINI\ASPNET'.
    >>

    >Anybody knows why? Thanks



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links