I have a list box which displays all the titles of the shows(listbox1) and a list box which shows all the titles of the pictures in that show(listbox2).
Im havin a problem filling the latter listbox (listbox2). I know I need to use data sets, adapters etc but everything i try keeps failing. Heres my code
Expand|Select|Wrap|Line Numbers
- DataRowView drv = (DataRowView)listBox1.SelectedItem;
- //set contents of the textbox on form title
- string variable1 = drv["title"].ToString();
- int x = 0;
- string user = Environment.UserName;
- sqlSelectCommand5.Connection.Open();
- sqlSelectCommand5.Parameters["@showName"].Value = variable1;
- sqlSelectCommand5.Parameters["@user"].Value = user;
- sqlSelectCommand5.Parameters["@showid"].Value = variable3;
- sqlDataAdapterShowPics.Fill(dataSetShowPics1);
- sqlSelectCommand5.Connection.Close();
- while (x < dataSetShowPics1.photos.Count);
- {
- string myPhotos = dataSetShowPics1.photos.Rows[x]["Expr1"].ToString();
- listBox2.Items.Add(myPhotos);
- x++;
my sql script in dataAdapterShowPics is:
SELECT shows.title, shows.showid, showspics.photoid, pics.photo, shows.userid, pics.title AS Expr1
FROM pics INNER JOIN
showpics ON pics.photoid = showpics.photoid INNER JOIN
shows ON showpics.showid = shows.showid
WHERE (shows.title = @showName) AND (shows.userid = @user)
Anyone have any ideas. I keep gettin the error message
"Input string was not in a correct format.Couldn't store <13656_173909643315_507673315_2984797_5377316_n> in Expr1 Column. Expected type is Int32."
("13656_173909643315_507673315_2984797_5377316_ n" is the picture name in the selected show)
Please help as Ive been trying to do this for over 12 hours now. I really need to get this done by tomorrow. Im at the end of my tether. I really do need all the help i can get I'm new to programming so be gentle n dumb things down as much as you can pretty please :-)