|
-
Mar 28th, 2008, 10:54 AM
#1
Thread Starter
Member
Vb.net App - SQL Database Login
I have a vb.net app connecting to a sql database.
When I run the app on the PC running Sql Server it logins ok.
When I try and run the app on a different PC, I get the following error
System.Data.SqlClient.SqlException: Login failed for user 'BM-PC\Guest'.
I am using the following connection string
Dim connstring As String = "server=BM-PC;Initial Catalog=EquinexMasterSql;User ID=username;Password=password;Trusted_Connection=False;"
It looks like the users, login and database security is configured correctly
in Sql Server Management Studio.
Any suggestions are most welcome.
-
Mar 29th, 2008, 01:22 PM
#2
Re: Vb.net App - SQL Database Login
I have a feeling that you've configured your SQL Server database to accept windows authentication rather than SQL Authentication. I also think that you may be making a web application rather than a "vb.net app" but that may be a moot point. You should look at your authentication settings on your SQL Server database.
-
Mar 31st, 2008, 05:49 AM
#3
Thread Starter
Member
Re: Vb.net App - SQL Database Login
I checked my sql authentication and its set to accept both windows and sql authentication.
My application is definitely a win forms application.
Silly question but is it necessary to install sql client software on the PC, or does my vb.net app not require this.
-
Mar 31st, 2008, 07:43 AM
#4
Re: Vb.net App - SQL Database Login
Do you have something like EXCEL on that same workstation that is giving you the login to GUEST error message??
-
Mar 31st, 2008, 08:07 AM
#5
Re: Vb.net App - SQL Database Login
The client softwear should be installed. Are you using the SQL Native client driver? The SQL Server driver is included with XP.
Sometimes the Programmer
Sometimes the DBA
Mazz1
-
Mar 31st, 2008, 09:45 AM
#6
Re: Vb.net App - SQL Database Login
But you don't need to install client software (like management studio or query analyzer) in order to run VB-client side apps against a remote DB.
I was asking if you had something like EXCEL on the client box so you could try to connect to the server/db with EXCEL and see what error popped up in that case.
-
Sep 12th, 2008, 07:56 AM
#7
Thread Starter
Member
Re: Vb.net App - SQL Database Login
I tried logging in to Sql through Excel with the following code but I get the following error - Login failed for user 'BM-PC\Guest'
I'm not sure where I type the username and password in my Excel VBA code.
Code:
Sub DataExtract()
' Create a connection object.
Dim cnPubs As ADODB.Connection
Set cnPubs = New ADODB.Connection
' Provide the connection string.
Dim strConn As String
'Use the SQL Server OLE DB Provider.
strConn = "PROVIDER=SQLOLEDB;"
'Connect to the Pubs database on the local server.
strConn = strConn & "DATA SOURCE=BM-PC;INITIAL CATALOG=EquinexMasterSql;"
'Use an integrated login.
strConn = strConn & " INTEGRATED SECURITY=sspi;"
'Now open the connection.
cnPubs.Open strConn
End SubSub DataExtract()
' Create a connection object.
Dim cnPubs As ADODB.Connection
Set cnPubs = New ADODB.Connection
' Provide the connection string.
Dim strConn As String
'Use the SQL Server OLE DB Provider.
strConn = "PROVIDER=SQLOLEDB;"
'Connect to the Pubs database on the local server.
strConn = strConn & "DATA SOURCE=BM-PC;INITIAL CATALOG=EquinexMasterSql;"
'Use an integrated login.
strConn = strConn & " INTEGRATED SECURITY=sspi;"
'Now open the connection.
cnPubs.Open strConn
End Sub
-
Sep 12th, 2008, 08:14 AM
#8
Re: Vb.net App - SQL Database Login
Is BM-PC\Guest and actual SQL Server Login Name? or is this a user on the PC
Sometimes the Programmer
Sometimes the DBA
Mazz1
-
Sep 12th, 2008, 10:03 AM
#9
Re: Vb.net App - SQL Database Login
I wanted you to use EXCEL to connect like this...
If you have office 2003...
Go into EXCEL - Menu Data>Import External Data>Import Data
Pop-up appears with Select External Data source - and +New SQL Server Connection.odc should appear.
The rest should be pretty obvious...
-
Sep 12th, 2008, 10:20 AM
#10
Thread Starter
Member
Re: Vb.net App - SQL Database Login
 Originally Posted by GaryMazzone
Is BM-PC\Guest and actual SQL Server Login Name? or is this a user on the PC
BM-PC is the name of the server running SQL, in my app I've hard coded the login but it tries to login as Guest rather then what is hard coded in the app.
 Originally Posted by szlamany
I wanted you to use EXCEL to connect like this...
If you have office 2003...
Go into EXCEL - Menu Data>Import External Data>Import Data
Pop-up appears with Select External Data source - and +New SQL Server Connection.odc should appear.
The rest should be pretty obvious...
I've managed to get Excel to connect to my Sql database using the SQL username and password.
-
Sep 12th, 2008, 10:33 AM
#11
Re: Vb.net App - SQL Database Login
You need to pass a user (login) that is stored in the SQL server Logins folder to this to work, unless of course you are in a domain and domain rights are correct. You don't pass the user of the OS.
Sometimes the Programmer
Sometimes the DBA
Mazz1
-
Sep 12th, 2008, 10:37 AM
#12
Thread Starter
Member
Re: Vb.net App - SQL Database Login
In my vb.net App I login with the following details, this lets me login when I'm using BM-PC but not when I am at a remote PC.
Surely if this information wasn't in the Sql server logins folder then I shouldn't be able to login from BM-PC either.
Public connstring As String = "server=BM-PC;Initial Catalog=EquinexMasterSql;User ID=Username;Password=Password;Trusted_Connection=False;"
-
Oct 30th, 2011, 04:01 PM
#13
New Member
Re: Vb.net App - SQL Database Login
I know this is an old thread but I'm having the same issue, was this ever resolved?
-
Oct 30th, 2011, 04:03 PM
#14
Re: Vb.net App - SQL Database Login
Welcome to the forum!
Best to start a new thread - show your code and your connection string - and give your specific error message.
No reason to bury your question in this thread.
-
Oct 30th, 2011, 04:06 PM
#15
New Member
Re: Vb.net App - SQL Database Login
 Originally Posted by szlamany
Welcome to the forum!
Best to start a new thread - show your code and your connection string - and give your specific error message.
No reason to bury your question in this thread.
thanks, I will do that...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|