locked
SqlDataSource InsertCommand with C#? RRS feed

  • Question

  • User260076833 posted

    Hi,

    I need an InsertCommand for a SqlDataSource with a distinction of cases:

    if (field1 = "A")
     INSERT INTO table1 (...) VALUES (...);
    else
     INSERT INTO table2 (...) VALUES (...);
    

    I cannot do this by setting the InsertCommand property to an INSERT statement.

    What I found is that I could use a Stored Procedure.

    What else can I do?

    Could I attache some C# code to the SqlDataSource that does the insert?

    Thanks
    Magnus

    Friday, June 26, 2015 2:20 AM

Answers

All replies