T
thebison
Hi all,
I hope someone can help with this relatively simple problem.
I am building a timesheet application using ASP.NET C# with Visual
Studio 2003.As it is only a protoype application, my database has been
made in MSDE.
I have a 'Create Resource' page where new employees are added to the
database. On my data-entry form I capture all the standard details for
the Resource table. I have two drop down boxes which are data bound and
populated with department IDs and manager IDs from other tables
(datasets). I have a stored procedure for inserting a new resource, and
when I click the 'Submit' button everything seems to work. However when
I look at the values inserted to the Resource table, everything is
correct apart from the two drop-down values which have defaulted to
'1', even when I select '3', or '4' or any other option in the
drop-down list. Whatever I do, when the record is written, it defaults
to the value of '1'.
The code for writing these two elements in the insert is:
sqlParam = cmd.Parameters.Add("@ManagerID", SqlDbType.Int, 4);
sqlParam.Value = ddManager.SelectedValue;
sqlParam = cmd.Parameters.Add("@DeptID", SqlDbType.Int, 4);
sqlParam.Value = ddDept.SelectedValue;
The weird thing is that when I use the same code on another form for a
drop-down which has 'hard-coded' values in the drop down list this
works fine.
Any help would be much appreciated! I'm sure it's something simple!
Thanks
Al
I hope someone can help with this relatively simple problem.
I am building a timesheet application using ASP.NET C# with Visual
Studio 2003.As it is only a protoype application, my database has been
made in MSDE.
I have a 'Create Resource' page where new employees are added to the
database. On my data-entry form I capture all the standard details for
the Resource table. I have two drop down boxes which are data bound and
populated with department IDs and manager IDs from other tables
(datasets). I have a stored procedure for inserting a new resource, and
when I click the 'Submit' button everything seems to work. However when
I look at the values inserted to the Resource table, everything is
correct apart from the two drop-down values which have defaulted to
'1', even when I select '3', or '4' or any other option in the
drop-down list. Whatever I do, when the record is written, it defaults
to the value of '1'.
The code for writing these two elements in the insert is:
sqlParam = cmd.Parameters.Add("@ManagerID", SqlDbType.Int, 4);
sqlParam.Value = ddManager.SelectedValue;
sqlParam = cmd.Parameters.Add("@DeptID", SqlDbType.Int, 4);
sqlParam.Value = ddDept.SelectedValue;
The weird thing is that when I use the same code on another form for a
drop-down which has 'hard-coded' values in the drop down list this
works fine.
Any help would be much appreciated! I'm sure it's something simple!
Thanks
Al