Re: OleDBDataAdapter => Insert and Update of data values in a Database
- From: Marcel Hug <marcel.c.hug@xxxxxxxxxx>
- Date: Sat, 31 Dec 2005 13:04:01 +0100
Hi Dries !
A first thing I would like to mention has to do with the use of Commands (in your case OleDbCommand):
- It is much safer to work with command-parameters instead of building your SQL-string. So create an OleDbCommand and set the CommandTextProperty to: "INSERT INTO FailureControl (ControlDate, ControlVersion) VALUES(?, ?)"
then add the OleDbParameters to the command. Check http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdataoledboledbcommandclasstopic.asp for more information.
I have seen this solution, but I think it is a little bit confusing. Why should I not use the popular and standartized SQL-Statements. Why something new ?
Then, to receive the ID of the last inserted row, the best solution depends on the database-system you are using. Post some more information please. I then will try to solve you whole problem.
I'm using a simple MS Access 2000 database. The ID is incremented and a primary key.
I have a new question:
I have datas in a dataset. I would like to save them in a new table (just created). Do I have to run trought all recordsets with an Insert into statement ?
Regards .
- Follow-Ups:
- References:
- Prev by Date: Re: BLOB (sqlserver) and timeouts
- Next by Date: Re: BLOB (sqlserver) and timeouts
- Previous by thread: Re: OleDBDataAdapter => Insert and Update of data values in a Database
- Next by thread: Re: OleDBDataAdapter => Insert and Update of data values in a Database
- Index(es):