You must Sign In to post a response.

System.IO.IOException: The device is not ready

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,


Comments

#441055    Author: Karthik K  11 Nov 2009 Member Level: Silver   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...


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.