Watch Pre-recorded Live Shows Here
Why Join
Become a member
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
C# Corner Home
Technologies
Monthly Leaders
ASK A QUESTION
Forum guidelines
Rene Nielsen
2.1k
22
30.6k
Cannot open database "GADatabase". The login failed. HELP!
Dec 7 2010 8:17 AM
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
Reply
Answers (
7
)
Search access database with multiple criterias
Alter parameter type