Cannot open database "GADatabase" requested by the login. The login failed. HELP!
Hey, i are in the makings of a program C# at my school, and i have a Databae in SQL Server management studios called GADatabase
I have my database class like this
- public class Database
- {
- private static SqlCommand ObjCmd;
- static string SqlConn = "Data Source=localhost\\SQLEXPRESS;Initial Catalog=GADatabase;Integrated Security=SSPI;";
- private static SqlConnection ObjConn = new SqlConnection(SqlConn);
- public Database()
- {
- }
- public void AddStudent(Student Student)
- {
- ObjConn.Open();
- ObjCmd = ObjConn.CreateCommand();
- ObjCmd.CommandType = System.Data.CommandType.Text;
- int i = 0;
- try
- {
- ObjCmd.CommandText = string.Concat(Student.InsertSqlQuery);
- i = ObjCmd.ExecuteNonQuery();
- }
- catch{ }
- ObjConn.Close();
- }
- }
but if i call the AddStudent and try to acces the ObjConn.Open(); it just returns and gives me the error "Cannot open database "GADatabase" requested by the login. The login failed."
Please if anyone can help me with this error :)
and feel free to ask for more information if that is what u need to help me with my problem

ArshadRank #2,492 · 564 reputationPosted Dec 7, 2010, 3:51 AM EST
Please make the below changes.
Regards,
Arshad
Rene Nielsen22 reputationPosted Dec 7, 2010, 4:17 AM EST
Guest UserRank #1,422 · 1.2K reputationPosted Dec 7, 2010, 10:46 AM EST
Rene Nielsen22 reputationPosted Dec 7, 2010, 2:15 PM EST
this is my setting for the user i have added in sql management studios
dont know if it helps u :)
this is the settingds
Guest UserRank #1,422 · 1.2K reputationPosted Dec 7, 2010, 4:30 PM EST
Rene Nielsen22 reputationPosted Dec 7, 2010, 4:45 PM EST
but i am gonna paste the whole error, maybe the exact error place is in there
{"Cannot open database \"GADatabase\" requested by the login. The login failed.\r\nLogin failed for user 'Rene-PC\\Rene'."}
Guest UserRank #1,422 · 1.2K reputationPosted Dec 8, 2010, 6:05 AM EST