Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Express Edition and Compact Edition (2005)
 sql express connection string

Author  Topic 

ponnurajs
Starting Member

6 Posts

Posted - 2006-11-09 : 05:35:18
Hai,

We created one application, with deployment. When we install the
application on another machine, it will attach a database in sqlexpress
instance. For eg. c:\Programfiles\oursoftwarename\kmsdb.mdf.


Now i am having one more webservice running on that machine as
dll(not webservice source code). In this web service i am reading that
database values. But the connection string is giving some error
message.


actually my coding is


sCon = "Server = ./SqlExpress;Database =KMSDB;Integrated Security =
SSPI;"


gsCon = New SqlClient.SqlConnection(sCon)
If gsCon.State = ConnectionState.Closed Then
gsCon.Open()
End If


sQuery = "SELECT KeyCode 'Key Code',Status
'Status',UserCode 'User Code',JobCode 'JobCode' " & _
" FROM KeyHolders"
oDaKeyHolders = New SqlClient.SqlDataAdapter(sQuery, gsCon)
oDaKeyHolders.Fill(oDsKeyHolders)


For this I am getting the error is


"Cannot open database "KmsDb" requested by the login. The login failed.
Login failed for user 'DESIGN-EMB2\user'."



Regards,
Raju



SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-11-09 : 05:38:55
Which user is the web service running with? The user used does not have permissions to the database.
www.connectionstrings.com


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

ponnurajs
Starting Member

6 Posts

Posted - 2006-11-09 : 05:45:09
Hai,

How we have to give the permission for that user.

Bec. first i am installing one software, in that i am having mdf file and attaching that file. After that i have to access that database through webservice. So, how to give the permission.

I am using only sql express.

Thank you.


Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-11-09 : 05:46:35
Which account (Windows) are you using for the web service?
Does that account have permissions to the database?


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -