Hi everyone,
I created a database in SSMS,but I can't connect to it using VB Express code.When I delete the database name from the server I can connect to server,but when I mention the name of the database or initial catalog,I receive a login failure error for the mentioned database...
My connection string is:
Dim conn1 As SqlConnection = New SqlConnection("Data Source=.\SQLEXPRESS;initial catalog=TEST1;" _
& "Integrated Security=True;" & "user instance=true;")
Everything is Local,I am using express version of SQL server and VB.How I am not be able to connect the database I created under the server in SSMS...I am really confused...
Thanks in advance!!!!
Can
What is the exact error message you are getting ?HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
|||
Hallo Mr Suessmeyer,
Yesterday you had also replied my question but I can't go ayn further.I downloaded SSMS,craeted a database under the server but I still get this error...How can I gain the access rights to the database that I created?
" Die von der Anmeldung angeforderte "database1"-Datenbank kann nicht ge?ffnet werden. Fehler bei der Anmeldung.
Fehler bei der Anmeldung für den Benutzer 'ADPLAN\atalay'. "
This was from the company's PC (where I write my thesis) I have a windows user account there...I also tried at home,I am the only user for windows XP at home but anyways I can not connect to the database,receiving the same error message.As I had written before if I leave Initial catalog= or database= fields empty then I am able to connect to the server...
Thanky in advance!
Can
|||For a quick one, try to add the user to the sysadmin group to let him access the database (if it is based on a security issue)
sp_addsrvrolemember [ @.loginame= ] 'login'
, [ @.rolename = ] 'role'
For granular configuration, use the following procedure to grant him access to the db (not any objects so far)
sp_grantlogin [@.loginame=] 'login'
sp_defaultdb [ @.loginame = ] 'login', [ @.defdb = ] 'database'
sp_grantdbaccess [ @.loginame = ] 'login'
[ , [ @.name_in_db = ] 'name_in_db' [ OUTPUT ] ]
The same can be done within the Managment Studio.
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
Thank you for the reply but I don't know where to enter this code...It'd be kind of you if you'd give more details,I am not a programmer which makes the things more difficult for me...
Regards,
Can
|||Hi,
no problem, download SQL Server Express Management Studio and execute the query within the Studio (there is a function to open a "New Query". Then type in the command with the appropiate values fitting to your production system.
Download via: http://msdn.microsoft.com/vstudio/express/sql/download/
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
hi,
I do think all this is related to the fact you are just using a user instance (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsse/html/sqlexpuserinst.asp)..
on the other side, when you execute SSMSE it usually connects to the "traditional" SQLExpress edition you installed, and these are 2 different instances..
regards
|||Thank you for all your replies.I solved my problem using SQL server management studio and using this query:
Use TEST1
go
exec sp_addlogin loginname,password,TEST1
go
exec sp_helplogins
go
then I added to this login to the database I wanted to connect,and I had to add login name and password to connection string(instead of user instances and integrated security).
Now it works this way.
Regards,
Can
No comments:
Post a Comment