on 10-25-2007 1:21 AM
I call a UserDataSource like this:
dsQuestions = objForm.DataSources.UserDataSources.Add("Questions", SAPbouiCOM.BoDataType.dt_LONG_TEXT, 254)
Is there anyway to remove "myData" from the form after I'm done with it? I would like to re-use the DataSource, but I get an error that the DataSource already exists when I do.
And yes, I can instantiate another DataSource. I just didn't want my code (and the system resources) to fill up with stuff that I don't need.
Thanks!
PS - releasing dsQuestions using:
System.Runtime.InteropServices.Marshal.ReleaseComObject(dsQuestions)
dsQuestions = Nothing
GC.Collect()
...doesn't work.
Hi Paul,
First u bound the datasource to control
oEdit.DataBind.SetBound(True,"","Questions")
then you reuse it again,
oEdit.DataBind.UnBound()
oEdit1.DataBind.SetBound(True,"","Questions")
Regards,Give me points,
G.Suresh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks,
I'm still having a problem with this though.
I'm binding UserDataSources to columns in a matrix. I know, but this is the only way it will work right now. There's a bug when using DBDataSources with a user table (2007A PL06).
I need to clear and re-use my UserDataSources. Or just kill them and re-instantiate them.
I have tried:
objMatrix.Columns.Item("coQualQ").DataBind.SetBound(False, "", "Questions")
objMatrix.Columns.Item("coQualQ").DataBind.UnBind()
Neither one of these will allow me to reuse the datasource. Once my code comes back to:
dsQualQues = objForm.DataSources.UserDataSources.Add("Questions", SAPbouiCOM.BoDataType.dt_LONG_TEXT, 254)
...I get error "-2018 - DataSource - Alias Already Exists".
Hi Paul,
you can add userdatasource only once to a form, it is just like a hidden item on the form.
once you are done with your business logic with the userdatasource,you reset it to some default value(myDatasource.valueEx="").
you can again use that when needed(myDatasource.valueEx=NewValue).
No need to add it again to the form as long as the form is alive the datasource will be with it.
regards
Vishnu
Paul, you can't remove a userdatasource. Instead, try adding it once, on the form_load event, then just use it when you need it or set it to "".
I went through the same issue until I started doing it this way. It's much easier.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
110 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.