Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Trying to set InsertCommand in code
Message
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
OS:
Windows XP
Database:
MS SQL Server
Divers
Thread ID:
01317677
Message ID:
01317747
Vues:
7
I'm thinking I'll change my approach and would use SP instead. But still the answer would be nice to know.

>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform