S
Stephen
I posted this on the msdn forums but wasn't having any luck. I am
using Visual C#, .Net 2.0, and SQL Server Express (soon to be ported to
SQL Server).
I have a dataset, binding source, and table adapter used in a form. I
am binding the controls to the binding source. I use the SqlCommand
method to add a new record via a stored procedure instead of the table
adpater's update method. Once the stored procedure has added the
record, I return (output param) the primary key and pass that to a
query in my table adapter as a param to rebind the form. Basically
it's like this:
this.TableAdapter.FillBy(this.DataSet.tableName,
Convert.ToInt32(primaryKeyValue));
If I put a breakpoint in the code before this statement, the
primaryKeyValue valiable has the right value in it. I then switch to
the IDE and open the dataset from the designer, run the FillBy query
with the new param, and the record shows up. However, when I continue
to run the code from the breakpoint, the record doesn't populate the
form. Also, I have a datagrid on another form bound to the same data
table that I use as a record selection method (for selecting existing
records). A user can click a button to open this form, select the
record, and populate the form. Even if I use this method after adding
the record, the record doesn't show in the selection datagrid on this
other form. Its almost as if the data isn't getting refreshed or
something. I can stop the debugger, reopen the form and the data is
there. I have searched high and low through the dataset, data tables,
form controls, table adapters, and cannot find what might be causing
this. I have another project that uses identical processes to handle
records and it works. I have done side-by-side comparisons of the two
projects and everything looks like it should. I am getting tempted to
start from scratch with the dataset, bindingsource and table adapters
if I can't figure it out, but it would be alot of work that I would
like to avoid. Anyone have any ideas?
As a follow-up, I did try to delete the data table and recreate it and
all the queries but it still does the same thing.
using Visual C#, .Net 2.0, and SQL Server Express (soon to be ported to
SQL Server).
I have a dataset, binding source, and table adapter used in a form. I
am binding the controls to the binding source. I use the SqlCommand
method to add a new record via a stored procedure instead of the table
adpater's update method. Once the stored procedure has added the
record, I return (output param) the primary key and pass that to a
query in my table adapter as a param to rebind the form. Basically
it's like this:
this.TableAdapter.FillBy(this.DataSet.tableName,
Convert.ToInt32(primaryKeyValue));
If I put a breakpoint in the code before this statement, the
primaryKeyValue valiable has the right value in it. I then switch to
the IDE and open the dataset from the designer, run the FillBy query
with the new param, and the record shows up. However, when I continue
to run the code from the breakpoint, the record doesn't populate the
form. Also, I have a datagrid on another form bound to the same data
table that I use as a record selection method (for selecting existing
records). A user can click a button to open this form, select the
record, and populate the form. Even if I use this method after adding
the record, the record doesn't show in the selection datagrid on this
other form. Its almost as if the data isn't getting refreshed or
something. I can stop the debugger, reopen the form and the data is
there. I have searched high and low through the dataset, data tables,
form controls, table adapters, and cannot find what might be causing
this. I have another project that uses identical processes to handle
records and it works. I have done side-by-side comparisons of the two
projects and everything looks like it should. I am getting tempted to
start from scratch with the dataset, bindingsource and table adapters
if I can't figure it out, but it would be alot of work that I would
like to avoid. Anyone have any ideas?
As a follow-up, I did try to delete the data table and recreate it and
all the queries but it still does the same thing.