Hi till now i am used window application in which there is no problem in connection using following code

Dim cnn As SqlConnection
        cnn = New SqlConnection("data source=RAKESH-676DD0E1;initial catalog=rw;integrated security=SSPI")
        cnn.Open()
        Dim da As SqlDataAdapter
        Dim dt As New DataTable
        da = New SqlDataAdapter("select * from publicity", cnn)
        da.Fill(dt)
        DataGrid1.DataSource = dt
        cnn.Close()

As i am not using userid & password instead i am using window authentication

But now i develop web application & used this code & also tried .NET toolbox oledbdataadpter & dataset but when I debug my application then the connection will be failed & show message

Server Error in '/webshoppe' Application.
--------------------------------------------------------------------------------

Login failed for user 'RAKESH-676DD0E1\ASPNET'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException: Login failed for user 'RAKESH-676DD0E1\ASPNET'.

Source Error:


Line 152: 'Put user code to initialize the page here
Line 153:
Line 154: OleDbDataAdapter1.Fill(DataSet11)
Line 155: End Sub
Line 156:


Source File: c:\inetpub\wwwroot\webshoppe\WebForm3.aspx.vb Line: 154

Stack Trace:


[OleDbException (0x80040e4d): Login failed for user 'RAKESH-676DD0E1\ASPNET'.]
System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr)
System.Data.OleDb.OleDbConnection.InitializeProvider()
System.Data.OleDb.OleDbConnection.Open()
System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState& originalState)
System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
webshoppe.WebForm3.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\webshoppe\WebForm3.aspx.vb:154
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()


please help.......

I'm sure you using SQL Server 2000
So, the error is you didn't give some permission to ASP.NET user who trying access SQL instance, therefore it blocked.
From server security in SQL Server Enterprise Manager, logins right click and add ASPNET user with windows authentication type.
Try running the application again then tell me what happened.

Thanks RamyMahrous it is working now

thanks alot

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.