Forums » .NET » ASP.NET »

System.IO.IOException: The device is not ready


Posted Date: 11 Nov 2009      Posted By:: Ramachandran     Member Level: Silver    Member Rank: 0     Points: 1   Responses: 1



Hai,

This error come to this register page.Insert into DefaultImage in

register page,so come to this problem,online only.this code is working fine to

localhost.

[Error:System.IO.IOException: The device is not ready]

[ FileStream fs = new FileStream("D:\\new vimmmiv\\images\\no_photo_large.jpg", FileMode.Open, FileAccess.Read);
BinaryReader br = new BinaryReader(fs);
byte[] photo = br.ReadBytes((int)fs.Length);
br.Close();
fs.Close();]

strConnection = ConfigurationManager.ConnectionStrings["Matrimony"].ToString();
con = new SqlConnection(strConnection);
con.Open();
Trans = con.BeginTransaction();
com9 = new SqlCommand("sp_image", con);
com9.CommandType = CommandType.StoredProcedure;
com9.Parameters.Add("@Reg", SqlDbType.Decimal).Value = r;
com9.Parameters.Add("@Image", SqlDbType.Image).Value = photo;
com9.Parameters.Add("@ImageType", SqlDbType.Char).Value = t;
com9.Parameters.Add("@LockCode", SqlDbType.VarChar).Value = l;
com9.Parameters.Add("@Createdon", SqlDbType.DateTime).Value = DateTime.Now;
com9.Parameters.Add("@Modifiedon", SqlDbType.DateTime).Value = DateTime.Now;
com9.Parameters.Add("@Flag", SqlDbType.Char).Value = s;
//com9.Parameters.Add("@ImageType", SqlDbType.Char).Value = t;
com9.Transaction = Trans;
com9.ExecuteNonQuery();

Thank You,







Responses

#441055    Author: Karthik K      Member Level: Silver      Member Rank: 0     Date: 11/Nov/2009   Rating: 2 out of 52 out of 5     Points: 2

For uploading images to a folder, you need to give access rights like read, write permission to that folder.Check with your system admin persons or webhosting.

Karthik...
Don't forget to rate the response...


 
Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.



Return to Discussion Forum
Start new thread

Subscribe to Subscribers
Active Members
TodayLast 7 Daysmore...

Awards & Gifts
Talk to Webmaster Tony John
Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India