attempting to retrieve some data in the database and set in into my form. the code goes

notificationList.Add(new notificationForm(
            "", x, y, alertId));

the arguments for my notificationForm is

public notificationForm(String name, String location, String imageExtension,
                        String alertType,String memberid,String date,String time,
                        int x,int y,String alertid)

the mistake goes

Not able to cast object of type 'System.Int32' to type 'System.String'.

at risk whereby i retrieve memberid. anybody understand how to fix that? it really works acceptable for memberName, locationName and photo though.


provides you with the integer value, when the datatype of memberid within the database is int. Then, either add ToString() in the finish or cast it for an int.



Cast it for an int (32bit integer), that is exactly what the error message is suggesting.

Check the kind of 'memberid' column within the database table. Most probably it's an integer.