Dataset Insert Parameters...

  • Thread starter Thread starter Nisha
  • Start date Start date
N

Nisha

Hello

I have a strong typed dataset, and when the add btn on the toolbar is
clicked I do the following - which basiscally defines the strongly typed
row, creates a new one & adds it to the dataset datarowcollection.

drow As ds_studies.sp_retrieve_studiesRow
drow = ds_studies.sp_retrieve_studies.Newsp_retrieve_studiesRow

ds_studies.EnforceConstraints = False

ds_studies.sp_retrieve_studies.Addsp_retrieve_studiesRow(drow)

The user finds a blank screen and proceeds on filling values into the
textbox controls / combo boxes etc. When the user clicks on the save button,
I do the dataset update and all the usual stuff like checking for a
successful update / retrieving the newly added row.


My problem: when I reach the line of code in the save btn i.e.
dataadapter.Update(dataset),

I expect to have my adapter.InsertCommand.Parameter Collection filled with
the user entered values:
The parameters look right, the source column in each of them is the colum
specified in the table mappings

However none of the parm values are filled in. I dont think I should be
filling in these values programatically. For your info my datasource is a
stored proc and the parms are exactly mapped to what the proc requires.

If anyone can shed some light on this, I'd appreciate it.

Thanks,
Nisha
 
HI Nisha,

Instead of passing dataset to dataadapter.Update(dataset) method, try
passing dataset.yourtable.
 
Hi Miha,

Thanks for your help. However this doesn't seem to help either. I have tried
innumerable scenarios such as changing the sourcecolumn within the
insertcommand parameter collection to proposed and changing the
updaterowsource property.

Even loading up the paramerter collection manually before the adapter.Update
method, is not working
i.e I did the following

adapter.InsertCommand.Parameter(0).value = tbx.text
and so on..

however if I check the profiler the Insert proc is being executed with

exec sp_insert_studies @parm1 = null, @parm2 = null

and so on.

WHAT COULD BE POSSIBLY WRONG HERE ??

Is there anything else I should be trying out?

Any suggestions are welcome.

Thanks,

....Nisha
 
Thanks again Miha... Yes this did work.

I think I need to understand the Bindingmanager a little better. I am still
a little confused why I have one way binding working and not the other
way... I suppose I need to read up a little more on this.

...Nisha
 
Hi Nisha,

Yes, they are a bit tricky. They are created implicitly. So you have to take
care how do you bind (arguments) because you might end with two bmb-s for
the same source.
As per your problem - bmbs normally create a buffer for editing in both edit
and add mode.
The buffer is stored to datasource only explicitly or when bmb moves
position.
 
Back
Top