i have created an application that takes a file and save it into database. here is the code
int len = FileUpload1.PostedFile.ContentLength;
byte[] pic = new byte[len];
FileUpload1.PostedFile.InputStream.Read(pic, 0, len);
cnn.Open();
cmd = new SqlCommand("insert into images values='" + pic + "'", cnn);
cmd.ExecuteNonQuery();
but when i click on upload it gives me the following error
Cannot open database "E_learning" requested by the login. The login failed.
i knw it is due to i have not used the uid and pwd options in db connection string. actually i am using the windows authentication mode in sql server. there is no user created for login through sql authentication mode. although i have created one. but i doesnt work. can somebody solve my problem?
Loading
Javeed M ShaikhPosted Oct 26, 2011, 9:23 AM
change your connection string like the following and try, or post your connection string here:
"Data Source=.\SQLEXPRESS;Initial Catalog=databasename;Integrated Security=True"