Click here to Skip to main content
15,914,419 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have an sql database with a table that hz three column 2 text column and an image column when i try to retreive d information in d table to a datagridview the image column only displayed a box with a red "x" sign then an exception "system.argumentException invalid parameter, when i try to close the exception box,it keeps appearing over and over again until i stopd debugin pls can sum1 help me to solve this i av been trying to solve this for the past 2 days

thanks in advance
Posted
Comments
pradiprenushe 24-Aug-12 5:31am    
Can you paste some code where you arer gettiing exception?
Ese ochuko 24-Aug-12 6:15am    
It didnt specify any line it only displayd it in a datagridView default error dialog box. Let me shw u more of d exception : system.ArgumentExcetion: parameter is not valid at System.Drawing.Image.FromStream(Stream stream, Boolean useEmbededColorManagement, Boolean validateImageData) at System.Drawing.ImageConverter.ConvertFrom(ITypeDescriptionContext context, CultureIfo culture,Object value)
at System.Windows.Form.Formatter.FomatObjectInternal(Object value, Type targetType, TypeConverter sourceConverter, TypeConverter targetConverter, String formatString, IFormatProvider formatInfo, Oject formattedNullValuee)
System.windows.form.DataGridViewCell.GetFormattedValue(Object value,int32 rowindex, DataGridViewCellStyle & cellStyle, TypeConverter valueTypeConverter, TypeConverter formattedValueTypeConverter, DataGridViewDataErrorContexts context)
the above is sum stuff displayd in d dialogbox it cnt b copied so i typed it
pradiprenushe 24-Aug-12 6:31am    
Add breakpoint at pageLoad. Press F10 to go debug stepwise. And find where error occurs. I dont get paste you source code & gridview bind code.
Ese ochuko 24-Aug-12 7:20am    
SqlConnection con = new SqlConnection();
public ManagePatient()
{initializeComponent();
Bind();
}
private void Bind()
{
try
{
con.ConnectionString="Data Source=Ese;initial catalog=house; id=sa; pwd= esoch";
con.open();
sqlDataAdapter da = new sqlDataAdapter("select*from patient", con);
DataTable dt = new DatTable();
da.fill(dt);
dataGridView1.DataSource=dt;
con.close ();
}
catch (sqlException exp)
{messageBox.Show("error" + exp.Message);
}}
}
am using c#
the patient table has id,name,age,place and image column it is retreiving the other column but the imge coumn diply a box wit red 'x' and d exception .
pls mayb in ur solution u cn add code or mayb give me a new code to use to retreive from the table for clerer undastanding cos am a biginer
tanks alot
Member 14677355 2-Apr-20 2:26am    
I have the same Problem....
Any one have solution in this problem??????.....

1 solution

The path to access the image is incorrect or you are unable to access the image for some reasons (maybe permissions).
This is also probably the cause for the error (invalid argument).
 
Share this answer
 
Comments
Ese ochuko 24-Aug-12 7:49am    
Sory am a biginer dnt knw much abt datagridview. do i nid to specify a path in my code to retreive from d table dat hz d image .can u help me with d code to do dat?
Tnks in advance

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900