473,405 Members | 2,354 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Selecting a item from one data table and getting the items from another - csharp

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

Expand|Select|Wrap|Line Numbers
  1.             DataRowView drv = (DataRowView)listBox1.SelectedItem;
  2.             //set contents of the textbox on form title
  3.             string variable1 = drv["title"].ToString();
  4.  
  5. int x = 0;
  6.                 string user = Environment.UserName;
  7.  
  8.  
  9.                         sqlSelectCommand5.Connection.Open();
  10.                         sqlSelectCommand5.Parameters["@showName"].Value = variable1;
  11.                         sqlSelectCommand5.Parameters["@user"].Value = user;
  12.                         sqlSelectCommand5.Parameters["@showid"].Value = variable3;
  13.  
  14.                         sqlDataAdapterShowPics.Fill(dataSetShowPics1);
  15.  
  16.                         sqlSelectCommand5.Connection.Close();
  17.  
  18.  
  19.                 while (x < dataSetShowPics1.photos.Count);
  20.                 {
  21.  
  22.                         string myPhotos = dataSetShowPics1.photos.Rows[x]["Expr1"].ToString();
  23.  
  24.                         listBox2.Items.Add(myPhotos);
  25.                         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 :-)
Mar 19 '10 #1
0 1013

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Ramesh | last post by:
hi, I am selecting fields from three table for manupulating data and i want to display total number of records selected. But i am always getting -1 value, eventhough 1000 of records are selected....
4
by: Paddy | last post by:
How do I select a subitem from a listview after clicking on the first column? Couldn't find it in MSDN. Thank you. Paddy.
0
by: Karthick Kumar | last post by:
Hi, I need to create a simple parent/child hierarchical menu. I have alread used the Treeview control but my requirement is slightly different than the Treeview control. I already have the kind...
2
by: Patrick.O.Ige | last post by:
I have some boolean value(1 or 0 ) in a table and i want a databinded CheckBoxList to present the selected values on the page.. With CheckBox i know i can se the Checked property like so :-...
2
by: Mike Kelly | last post by:
Hi. I have a data table where rows are grouped according to a certain criteria and I want to be able to display all the rows that belong to the same group together on the screen. In addition, I...
11
by: Ron L | last post by:
I have a data table that lists a series of items in my database. In my user form, I want the user to be able to filter by a number of criteria (e.g. location, contract, date modified, etc). Other...
4
by: rn5a | last post by:
I am binding a DropDownList with records existing in a database table. I want to add an extra item *SELECT COMPANY* at index 0 so that by default, it gets selected. This is how I tried it but the...
2
by: jw01 | last post by:
I have a form in which there is one combo box and three text boxes: Combo Box: -> Item A -> Item B -> Item C TextBox1: TextBox2: ...
4
by: darrel | last post by:
I have a DDL list along these lines: item value="1" text="a" item value="2" text="b" item value="3" text="c" item value="2" text="d" item value="2" text="e" item value="1" text="f" item...
4
by: Danny | last post by:
Hi all, So I have these tables of items and item-types, and the items can be of several types: Items: ID ; Name 1 ; Item1 2 ; Item2
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.