Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Trying to set InsertCommand in code
Message
 
 
To
All
General information
Forum:
ASP.NET
Category:
Other
Title:
Trying to set InsertCommand in code
Environment versions
OS:
Windows XP
Database:
MS SQL Server
Miscellaneous
Thread ID:
01317677
Message ID:
01317677
Views:
50
Hi everybody,

I could not figure out a proper way to set InsertCommand for the SQLDataSource used by the FormView in the code and where (which method in the page) I can do this.

Right now I have it in the
protected void ddlPersonType_SelectedIndexChanged(object sender, EventArgs e)
    {         
        DropDownList ddl = (DropDownList)sender;
        this.PersonType = ddl.SelectedValue;

        string SelectedItem = ddl.SelectedItem.ToString();
        switch (SelectedItem)
        {
            case "Special Friend":
                this.PeopleFriendsDataSource.InsertCommand =
                @"BEGIN TRAN 
                  INSERT INTO Registration 
                  (FirstName, MiddleName, LastName, Gender, 
                   DOB, Address1, Address2, City, State, Zip, 
                   Email, ScreenName, HomePhone, CellPhone, 
                   Comment, UserName, Pwd, 
                   School, Grade, MedicalConcerns, Medications, NonActivities, 
...
and I'm getting an error that the form doesn't have InsertCommand specified.

How and where can I set it?

Thanks a million in advance.
If it's not broken, fix it until it is.


My Blog
Next
Reply
Map
View

Click here to load this message in the networking platform