Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Member
2 Points
1 Post
Nov 07, 2008 11:57 AM|LINK
byte[] myimage = new byte[imageupload.PostedFile.ContentLength]; HttpPostedFile Image = imageupload.PostedFile; Image.InputStream.Read(myimage, 0, (int)imageupload.PostedFile.ContentLength); SqlConnection myConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["dateofbirthConnectionString3"].ConnectionString); SqlCommand storeimage = new SqlCommand("INSERT INTO dobtable " + "(Image_Content, Image_Type, Image_Size,day,month,year,imagename) " + " values (@image, @imagetype, @imagesize,@day,@month,@year,@imagename)", myConnection); storeimage.Parameters.Add("@day", ddlday.SelectedItem.Text); storeimage.Parameters.Add("@month", ddlmonth.SelectedItem.Text); storeimage.Parameters.Add("@year", ddlyear.SelectedItem.Text); storeimage.Parameters.Add("@image", SqlDbType.Image).Value = myimage; storeimage.Parameters.Add("@imagename", txtimagename.Text); storeimage.Parameters.Add("@imagetype", SqlDbType.VarChar, 100).Value = imageupload.PostedFile.ContentType; storeimage.Parameters.Add("@imagesize", SqlDbType.BigInt, 99999).Value = imageupload.PostedFile.ContentLength; myConnection.Open(); storeimage.ExecuteNonQuery(); myConnection.Close(); GridView1.DataSource = FetchAllImagesInfo(); GridView1.DataBind();
and my error is same as yours i.e Both DataSource and DataSourceID are defined on 'GridView1'. Remove one definition.Could you help me in deleting this error
lakshmi_komm...
Member
2 Points
1 Post
Re: Hai...
Nov 07, 2008 11:57 AM|LINK
byte[] myimage = new byte[imageupload.PostedFile.ContentLength]; HttpPostedFile Image = imageupload.PostedFile; Image.InputStream.Read(myimage, 0, (int)imageupload.PostedFile.ContentLength); SqlConnection myConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["dateofbirthConnectionString3"].ConnectionString); SqlCommand storeimage = new SqlCommand("INSERT INTO dobtable " + "(Image_Content, Image_Type, Image_Size,day,month,year,imagename) " + " values (@image, @imagetype, @imagesize,@day,@month,@year,@imagename)", myConnection); storeimage.Parameters.Add("@day", ddlday.SelectedItem.Text); storeimage.Parameters.Add("@month", ddlmonth.SelectedItem.Text); storeimage.Parameters.Add("@year", ddlyear.SelectedItem.Text); storeimage.Parameters.Add("@image", SqlDbType.Image).Value = myimage; storeimage.Parameters.Add("@imagename", txtimagename.Text); storeimage.Parameters.Add("@imagetype", SqlDbType.VarChar, 100).Value = imageupload.PostedFile.ContentType; storeimage.Parameters.Add("@imagesize", SqlDbType.BigInt, 99999).Value = imageupload.PostedFile.ContentLength; myConnection.Open(); storeimage.ExecuteNonQuery(); myConnection.Close(); GridView1.DataSource = FetchAllImagesInfo(); GridView1.DataBind();
and my error is same as yours i.e Both DataSource and DataSourceID are defined on 'GridView1'. Remove one definition.Could you help me in deleting this error