Hi ok i have 3 tables "pics", "shows" and "showspics" .
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
my sql script in dataAdapterShow Pics is:
SELECT shows.title, shows.showid, showspics.photo id, pics.photo, shows.userid, pics.title AS Expr1
FROM pics INNER JOIN
showpics ON pics.photoid = showpics.photoi d 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_17390964 3315_507673315_ 2984797_5377316 _n> in Expr1 Column. Expected type is Int32."
("13656_1739096 43315_507673315 _2984797_537731 6_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 :-)
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
Code:
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 dataAdapterShow Pics is:
SELECT shows.title, shows.showid, showspics.photo id, pics.photo, shows.userid, pics.title AS Expr1
FROM pics INNER JOIN
showpics ON pics.photoid = showpics.photoi d 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_17390964 3315_507673315_ 2984797_5377316 _n> in Expr1 Column. Expected type is Int32."
("13656_1739096 43315_507673315 _2984797_537731 6_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 :-)