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
Guest UserPosted Dec 8, 2010, 11:05 AM
Rene NielsenPosted Dec 7, 2010, 9:45 PM
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 UserPosted Dec 7, 2010, 9:30 PM
Rene NielsenPosted Dec 7, 2010, 7:15 PM
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 UserPosted Dec 7, 2010, 3:46 PM
Rene NielsenPosted Dec 7, 2010, 9:17 AM
ArshadPosted Dec 7, 2010, 8:51 AM
Please make the below changes.
Regards,
Arshad