Saturday, March 31, 2012

triggering SQLDATASOURCE insert or update command programatically?

Is there any way to initiate a sqldatasource insert from code in place
of the button with commandname=insert or insert?
I have a formview with a datasource with an insert command on a
button. When the button is selected the insert is performed.
Say I have another button on the form with no command syntax that calls
a some sub. Is there any way to call the same sqldatasource insert
function from code? in debug when I look at the onclick sub that I am
calling when the insert button is pressed, i see all the properties of
the button, like commandname=insert, but that sub is not the real deal
and is infact not even doing anything.
Thanks.Hi,
Have you tried calling the Insert method of the sqldatasource directly, it
should do what you want
Regards,
Mohamed Mosalem
http://mosalem.blogspot.com
"Jason" wrote:

> Is there any way to initiate a sqldatasource insert from code in place
> of the button with commandname=insert or insert?
> I have a formview with a datasource with an insert command on a
> button. When the button is selected the insert is performed.
> Say I have another button on the form with no command syntax that calls
> a some sub. Is there any way to call the same sqldatasource insert
> function from code? in debug when I look at the onclick sub that I am
> calling when the insert button is pressed, i see all the properties of
> the button, like commandname=insert, but that sub is not the real deal
> and is infact not even doing anything.
> Thanks.
>
somebody else suggested that so I tried it, but when I do that for some
reason it does not see bound fields. I had two buttons up, one calling
a sub that did what you suggested and another with no code behind doing
commandname=insert and the only the later would work.
Mohamed Mosalem wrote:
> Hi,
> Have you tried calling the Insert method of the sqldatasource directly, it
> should do what you want
> Regards,
> Mohamed Mosalem
> http://mosalem.blogspot.com
> "Jason" wrote:
>

0 comments:

Post a Comment