Click here to Skip to main content
15,879,535 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi i made program with c# and sql express and i want to open my program in another PC and i installed sql express in my user PC but when i want to open the program it give me an error what should i do to open it in another PC?
this is my sql connection
C#
SqlConnection sql = new SqlConnection(@"server=.\SQLEXPRESS;database=student;integrated security=true;");

and this is the problem
http://upload7.ir/imgs/2014-10/34014132393299938740.jpg[^]
With Respect "Spaceman"
Posted

When using integrated security on SQL server your user account from the machine you are connecting with must have permission to access that SQL server.

http://stackoverflow.com/questions/3998634/sql-server-2008-how-do-i-grant-privileges-to-a-username[^]
 
Share this answer
 
Well, it says 'Cannot Open Database "Student"' (more or less)

So, did you copy/import your database from your dev pc to this 'user pc' ? (not sure of the exact way to move or copy a database, but there are docs around on how to deploy it)

- or, re-init the Student database from scratch on the 'user' pc

'g'
 
Share this answer
 
Hi,

As per the error messages , seems like it related to permission .You need to grant the necessary permissions to
student database for the mentioned user.

Thanks
 
Share this answer
 
Comments
Avenger1 15-Oct-14 6:51am    
how can i do it for my User in my PC?
With Respect "Spaceman"
Hi,

Please refer the below link.

http://stackoverflow.com/questions/3998634/sql-server-2008-how-do-i-grant-privileges-to-a-username[^]

If this link is not helping ,please Google on this .I am sure you will get the required information.

Thanks
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900