ASP.NET quickie (c#)

Associate
Joined
21 Oct 2002
Posts
535
Hi chaps right im in a bit of a pickle with some .NET.

I have a DropDownList which is populated with data from a Access Database, what im trying to do is get it to store the selected item from the list in another table, but it keeps giving me the following error on this line of code:-
Code:
dr["syndicate"]=DropDownList1.SelectedItem.Text;

heres the error:

System.FormatException: Input string was not in a correct format. at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) at System.String.System.IConvertible.ToInt32(IFormatProvider provider) at System.Convert.ToInt32(Object value) at System.Data.Common.Int32Storage.Set(Int32 record, Object value) at System.Data.DataColumn.set_Item(Int32 record, Object value)Couldn't store <Another Syndicate> in syndicate Column. Expected type is Int32.

its getting on my **** a bit, heres my code

Code:
		private void Button2_Click(object sender, System.EventArgs e)
		{
			myDataAdapter.Fill(dsPeople1,"Users");
			DataRow dr =dsPeople1.Tables["Users"].NewRow();
			dr["U_name"]=TextBox2.Text;
			dr["email"]=TextBox3.Text;
			dr["syndicate"]=DropDownList1.SelectedItem.Text;
			dsPeople1.Tables["Users"].Rows.Add(dr);
			myDataAdapter.Update(dsPeople1,"Users");
			myDataAdapter.Fill(dsPeople1,"Users");
			DataGrid1.DataSource=dsPeople1;
			DataGrid1.DataBind();
		}
 
Back
Top Bottom