Groups | Blog | Home
all groups > dotnet ado.net > june 2007 >

dotnet ado.net : Connection String Help


Charles A. Lackman
6/29/2007 10:25:34 AM
Hello I am trying to connect to a liked table.

When I run this query a window pops up that wants a User Name and Password:
No User Name and Password is Required - If I click ok (without credentials)
the query runs fine. The problem is that I am trying to send the
credentials in my connection string so that the window doesn't pop up. I am
running a simple query (similar to this) in a Windows Service - so no window
pops up but nothing is returned.


Dim ADataAdapter As OleDb.OleDbDataAdapter
Dim AConnection As New
OleDb.OleDbConnection("Provider=Microsoft.jet.OLEDB.4.0;Data Source=" &
Me.DatabaseLocation & ";User Id= ; Password= ;")

ADataAdapter = New OleDb.OleDbDataAdapter("SELECT * FROM Table1,
AConnection)

AConnection.Open()
ADataAdapter.Fill(ADataSet, "Temp")
AConnection.Close()

I have experimented with multiple ways of getting this work with no success:

Dim AConnection As New
OleDb.OleDbConnection("Provider=Microsoft.jet.OLEDB.4.0;Data Source=" &
Me.DatabaseLocation & ";User Id= ''; Password= '';")

AND

Dim AConnection As New
OleDb.OleDbConnection("Provider=Microsoft.jet.OLEDB.4.0;Data Source=" &
Me.DatabaseLocation & ";User Id=admin ; Password= 1111;")

If I put "admin" in the UserName and "1111" in the password pop up box, it
lets me in - however, it does not work in the connection string: I receive
a workgroup logon error.

Any assistance will be greatly appreciated,

Thanks,
Chuck

Miha Markic
6/30/2007 12:00:00 AM
Take a look at www.connectionstrings.com

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

[quoted text, click to view]
Charles A. Lackman
7/1/2007 8:00:53 PM
Thanks for your help,

Chuck

[quoted text, click to view]
Take a look at www.connectionstrings.com

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

[quoted text, click to view]

AddThis Social Bookmark Button