SqlCeDataAdapter Commands

G

Ghost

Hello.
I have such question:

I want to create SqlCeDataAdapter object at runtime...

I'm writing:
SqlCeDataAdapter dataAdapter = new SqlCeDataAdapter();

then I specify Select Command:
dataAdapter.SelectCommand = new SqlCeCommand("SELECT * FROM Supplier",
sqlCeConnection);

I want specify other commands too, such as Insert, Update and Delete
commands, but they are too large for inserting it into my code manualy, when
I'm working not in Compact Framework I can just drag the DataAdapter
component to my form and allow it while its configuration to generate these
commands automaticaly, so I can Update my datasets and not only view them.
Is there any method to generate SqlCeDataAdapter commands automaticaly at
runtime and don't insert them to my code manualy ?

If its poseble PLEASE show me some example or demo.
 
J

Jon Skeet [C# MVP]

Ghost said:
I have such question:

I want to create SqlCeDataAdapter object at runtime...

I'm writing:
SqlCeDataAdapter dataAdapter = new SqlCeDataAdapter();

then I specify Select Command:
dataAdapter.SelectCommand = new SqlCeCommand("SELECT * FROM Supplier",
sqlCeConnection);

I want specify other commands too, such as Insert, Update and Delete
commands, but they are too large for inserting it into my code manualy, when
I'm working not in Compact Framework I can just drag the DataAdapter
component to my form and allow it while its configuration to generate these
commands automaticaly, so I can Update my datasets and not only view them.
Is there any method to generate SqlCeDataAdapter commands automaticaly at
runtime and don't insert them to my code manualy ?

If its poseble PLEASE show me some example or demo.

You can use SqlCeCommandBuilder if the schema is sufficiently simple,
but personally I'd recommend specifying all the commands explicitly. It
makes it a lot easier to work out what's going on if things go wrong.
 
G

Ghost

Yes schema is simple, but there is many fields (about 30).
How do I use SqlCeCommandBuilder?
can you show me seamle example please.
 
J

Jon Skeet [C# MVP]

Ghost said:
Yes schema is simple, but there is many fields (about 30).

And will you be updating all of them? I'd still either do it by hand or
write my own code to build the other commands - that way if it doesn't
quite work, I could tweak it.
How do I use SqlCeCommandBuilder?
can you show me seamle example please.

Look up SqlCommandBuilder and look at the example there - I'd be very
surprised if SqlCeCommandBuilder was used differently.
 

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

Top