DataSet designer won't let me set GenerateDBDirectMethods to true

A

Alan Silver

Hello,

I am trying to persuade VS2005 to let me use a DataSet to insert to a
table. I add a DataSet item to the App_Code folder, and the wizard comes
up. I go through the steps, but when I get to the step where it asks if
I want to fill or return a datatable, the third option, to generate
methods for insert, update and delete is greyed out.

According to MSDN... "This option is unavailable when the original SQL
statement does not provide enough information or the query is not an
updateable query. This situation can occur, for example, in JOIN queries
and queries that return a single value (scalar)." I can't see how this
is relevant as I tried it with the simplest of SQL queries.

The really weird thing is that some of the tables in the database allow
the option to be set, and some do not. I have stared stupidly at these
tables trying to spot some difference, but I can't.

Anyone any ideas? TIA
 
A

Alan Silver

Alan Silver said:
Anyone any ideas? TIA

In case it helps anyone, I discovered that if you use "select * from
table" for the SQL, it works. You can then look at the properties of the
adapter, and open the query builder for the select command. This will
replace the * with the field names, at which point you can either just
save it, or edit the field list and then save it.

Having said that, I did discover further that you don't actually need
this feature at all. Once you have the adapter set up, you can just add
a new query, set it to be an insert and it will create a nice method for
you. Much easier, and it only creates the methods you want, rather than
extras that you don't want.

I still think the behaviour I observed was a bug, but I'm not going to
bother with it.

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top