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