Hi,
A bit long winded this one, but would be grateful for some help.
I have a problem using the Wizard component and can think of only two
ways of completing the task.
Can anyone with some Wizard experience have a read of my two methods and
let me know if there are alternatives?
1. Each step of the wizard has each component (Textboxes etc) dropped
on. This means I cannot use data binding and
have to write a lot of code, both for adding then saving the details.
2. I use FormViews & SqlDataSoruce on each Wizard step, allowing 2 way
data binding,
but the Next button needs to have a Command Name of Insert.
On the Inserting method I capture the newly created Command object and
hold it in the Session.
The Next button has an On_Click event to
increment the Wizard step. This is repeated for each step and at the
Finish step I use the stored Command objects wrapped around a
transaction
to verify all Inserts were successfull.
So, pass in the 3 Command objects (my wizard has 3 steps)
public bool Insert(SqlCommand cmd1, SqlCommand cmd2, SqlCommand cmd3)
{
SqlCommand masterCmd = new SqlCommand();
//Open connection etc
//Start a transaction using masterCmd
masterCmd.CommandText = cmd1.CommandText;
masterCmd.CommandParameters = cm1.CommandParamters; //Might not be
as easy this.
masterCmd.ExecuteNonQuery();
masterCmd.Paramters.Clear(); //We need to add new params
//repeat this process for cmd2 & cmd3
//Rollback or Commit
}
Ideally I would have preferred calling Insert() directly from my
webpage, but this does not seem to work.
The parameters are always null.
If someone could spare 5 minutes and add a FormView with a SqlDataSource
and attempt to Invoke the Insert manually
(ie dont have an insert button on the FormView with a Command Name
Insert). Just add a normal button and make a
call to the SqlDataSources Insert method.
Can anyone help?
Steven
*** Sent via Developersdex http://www.developersdex.com ***