Monday, February 20, 2012

Problem inserting into SQL database

I am using visual devloper express, and i have been following allow in the "starter videos". for lesson 8, the example worked fine, but when i try to replicate the example with a SQL database (external one) when I am configuring the formView, and i try to click the advanced tab under 'Advanced SQL Generation Options", I do not have the abilty to check the 2 boxes for generate insert, update, delete statements, etc (they are greyed out).

i have an asp page that has the same connection as this page and i am able to insert a record, so i am sure it's not a permission thing...

I don't understand what I am doing wrong here... a plain old asp coded page inserts records into this table in the same database, but I am unable to check the boxes for "generate insert" etrc, and the error I get on the page itself is

Inserting is not supported by data source 'SqlDataSource1' unless InsertCommand is specified.

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details:System.NotSupportedException: Inserting is not supported by data source 'SqlDataSource1' unless InsertCommand is specified.

Hi,

According to your question, you say that you don't have the abilty to check the 2 boxes for generate insert,update,delete statements.(they are greyed out). There are two reasons:

1. Be sure that there's primary key field in your data table because you must have all primary key fields selected for this option to be enabled.

2. Be sure that the data table you selected is not read-only. (Note: Sample tables just like Northwind,pubs and etc. are read-only.)

Hope it helps.

Thanks.

No comments:

Post a Comment