Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
|
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 8th, 2003, 09:15 AM
Registered User
 
Join Date: Oct 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Creating INSERT queries dynamically at runtime

I have an application wherein i am creating data entry forms dynamically and then insert the data back to the table.
The problem is that when i do an insert, i have to create an insert query at runtime.
Can u give me suggestions about what feature in ado.net allows me to build an INSERT query without knowing the names of the columns or the number of the columns beforehand.
 
Old October 8th, 2003, 05:13 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Do you know the names of the tables? Usually when you deal with a dataset, you get the names of the columns in a collection. You should be able to build queries with that. However, I imagine you will have to do a lot of checking to determine if certain fields can be populated (i.e. Identity columns can't be populated.)

Peter
 
Old October 9th, 2003, 12:15 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

im not sure about ur question but i guess u r insering diffrent fields in diffrent times! I mean insert do not insert fix number or type of fields! In that case use SP & send parameters to that, & then manage it in ur SP.

Always:),
Hovik Melkomian.
 
Old January 26th, 2004, 10:38 AM
Registered User
 
Join Date: Jan 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You can use the CommandBuilder object provided by any of the Managed Provider( SQL, OLEDB or ODBC).Just set the CommandBuilder object to track the DataAdapter object.Then update your DataSet through DataAdapter.SQL commands will be automatically generated by the CommandBuilder.

Read more in MSDN by searching "Automatically Generated Commands"

Hope it helps you !!!








Similar Threads
Thread Thread Starter Forum Replies Last Post
creating temporary tables instead of queries clwk Access VBA 4 March 12th, 2007 02:50 PM
Creating Conrols dynamically jamil umar ASP.NET 1.0 and 1.1 Basics 3 February 13th, 2006 01:02 PM
dynamically creating control rahulpokharna Pro VB Databases 1 January 10th, 2006 04:41 PM
update/insert work in queries but not on form jonicholson Access VBA 3 January 18th, 2005 06:05 PM
Dynamically Link MySQL Tables at Runtime Rational Access 0 June 27th, 2004 09:15 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.