none
Cannot generate DBDirect UPDATE/INSERT Commands for updatable Views RRS feed

  • Question

  • Using Visual Studio 2008:

     

    In my SQL 2000 database, I have a table called tblTest, and a View called viewTest, which is just a SELECT * FROM tblTest.

     

    In the dataset designer, I specify a DataTable which has SELECT * FROM tblTest as a SelectCommand. If I set GenerateDBDirectMethods to true on the Table Adapter, the appropriate update, delete, and insert commands will be created automatically.

     

    If I now change the SelectCommand to SELECT * FROM viewTest, I cannot set GenerateDBDirectMethods to true again. I get the error "Property value is not valid. The type of the database object does not allow to set GenerateDBDirect to true."

     

    I don't understand this. The view is updatable, so why can't I generate DB Direct Methods?

     

    I also tried to generate Stored Procedures - here the same problem: I can only auto-generate SELECT SP's, not UPDATE/INSERT/DELETE.

     

    Thanks for any help

    Wednesday, July 2, 2008 3:07 PM

Answers

  • No, you cannot force it to generate something for you. The only way, in a case when it fails to generate commands, is to create them explicitely from the code.

     

    Monday, July 7, 2008 9:44 AM
    Moderator

All replies

  • It is because provider does not have enough information (from the view) to generate appropriate action SQL statements. Even if it is simple view, you could get into this situation and need to create all action SQL statements by yourself.

     

    Friday, July 4, 2008 10:27 AM
    Moderator
  • is there any way to supply all the info the dataset designer needs to generate CUD Statements for views? what is this info anyway, is this documented somewhere? I couldn't find any appropriate documentation.

     

    Sunday, July 6, 2008 6:34 PM
  • No, you cannot force it to generate something for you. The only way, in a case when it fails to generate commands, is to create them explicitely from the code.

     

    Monday, July 7, 2008 9:44 AM
    Moderator