Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem binding my DataGrid

Status
Not open for further replies.

redcare

Technical User
May 20, 2001
32
0
0
GB
Hi
I am trying to bind data in my SQL database to a datagrid in MS Visual Basic.net on my local machine
I have set up the connection ok and if I run Data\Preview Data, in MS Visual Basic.net I can see the expected fields and colums no problem.
However when I build and browse the web page I get the error listed below:
I have tried using both SQLDataAdapter1 and OleDbDataAdapter1 both give me the same error.
I have created a dataset called dsCategories and bound it to the datasource property of my datagrid.
I am connecting to my SQL database with SQL authentication as I cannot seem to create a connection using windows authentication.
Line 92 is where it is highlighted when the error comes up.
I am running IIS on my local machine.

Any advice will be greatly appreciated.

Regards
Redcare


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

Login failed for user 'sa'.
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 'sa'.

Source Error:


Line 90: 'Put user code to initialize the page here
Line 91: If Not IsPostBack Then
Line 92: OleDbDataAdapter1.Fill(DsCategories1)
Line 93: DataGrid1.DataBind()
Line 94: End If


Source File: C:\Inetpub\ Line: 92

Stack Trace:


[OleDbException (0x80040e4d): Login failed for user 'sa'.]
System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr) +20
System.Data.OleDb.OleDbConnection.InitializeProvider() +57
System.Data.OleDb.OleDbConnection.Open() +203
System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState& originalState) +44
System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +304
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +77
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) +38
WebDataEntry.WebForm1.Page_Load(Object sender, EventArgs e) in C:\Inetpub\ System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731
 
What is your connection string? That is where the problem is. Your connection string has sa for the user and the server is not allowing it access.

OleDbException (0x80040e4d): Login failed for user 'sa'.]

make sure you are using a correct user: pwd:

DotNetDoc
M.C.S.D.
---------------------------------------

Tell me and I forget. Show me and I remember. Involve me and I understand.
- Anonymous Chinese Proverb
-----------------------------------
If you can't explain it simply, you don't understand it well enough.
- A. Einstein
 
Thanks for your reply.
I was thinking along the same lines as well.
What I have done after mailing this question is:
1. I deleted the connection I had in VB.Net to my SQL server
and then reconnected, this didn't work straight away.
2. Then I took out all references to my SQL server in IIS services and reentered them as I needed them and then reconnected to my SQL server through VB.net and this appears to have done the trick
Again thanks very much for your help.

Redcare.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top