.NETGURU
DataSet Tables into Access tables with Oledb?
Messages   Related Types
This message was discovered on microsoft.public.dotnet.framework.adonet.

Post a new message to this list...

Nevyn Twyll
I've got several datatables in a dataset that I've filled programattically.
The structure of the datatables match the structure of tables in an access
database.

What is an easy, programmatic way to insert all those datatable records into
the tables in Access without manually generating parameterized
InsertCommands for an OleDBDataAdapter?

I tried the following using an OleDbCommandBuilder to try and build the
InsertCOmmand,, and it generated an error "Microsoft JET Database Engine:
Operation must use an updateable query."

Dictionary.ECMDBDataset.MyDataTable dtMyTable;
OleDbConnection odbConn;

<...>

OleDbDataAdapter odbadapt = new OleDbDataAdapter();

odbadapt.SelectCommand = new OleDbCommand("SELECT Myfield1, Myfield2 From
[MyDataTable];", odbConn );

OleDbCommandBuilder cb = new OleDbCommandBuilder(odbadapt);

odbadapt.InsertCommand = cb.GetInsertCommand();

odbadapt.Update(dtTableList);

Help?

Reply to this message...
 
    
Miha Markic [MVP C#]
Hi Nevyn,

You might drag&drop table from Server Explorer to the form - it will
autogenerate an adapter for you.
Other way: you might try using my template (for free utility CodeSmith) to
autogenerate the adapter:
http://www.rthand.com/DesktopModules/Articles/ArticlesView.aspx?tabID=0&alias=RightHand&lang=en-US&ItemID=7&mid=10244

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

"Nevyn Twyll" <Click here to reveal e-mail address> wrote in message
news:%23n7S6%23%Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Nevyn Twyll
I can't seem to use the templates on your website - they download without a
file extension, and when i try to open them as a .cst in CodeSmith, it
generates an error.

Help?

"Miha Markic [MVP C#]" <miha at rthand com> wrote in message
news:e9LAoL$Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Miha Markic [MVP C#]
Hi,

Try running CodeSmith and open it from within CodeSmith.
It is a text file afterall :-)

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

"Nevyn Twyll" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Nevyn Twyll
Okay, I'm lame but I'm not that lame.
It causes a parse error on opening.

"Miha Markic [MVP C#]" <miha at rthand com> wrote in message
news:OZ$Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Nevyn Twyll
Yeah, I did. It generates an error.

"Miha Markic [MVP C#]" <miha at rthand com> wrote in message
news:OZ$Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Nevyn Twyll
Yeah, I did. It generates an error.

"Miha Markic [MVP C#]" <miha at rthand com> wrote in message
news:OZ$Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
 
System.Data.OleDb.OleDbCommand
System.Data.OleDb.OleDbCommandBuilder
System.Data.OleDb.OleDbConnection
System.Data.OleDb.OleDbDataAdapter




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification