Data Access using Enterprise Libraries

G

Guest

Hello All:

I am trying to use the Enterprise Libraries created by Microsoft to update a
DB2 database and am stuck. I need to be able to Insert, Update and Delete
records from the DB2 datbase tables. I can use the UpdateDataSet method to
do this, but I am not sure how to use it. I have Googled the method and
haven't relly found anything helpful. Here's one question:

The method takes several parameters, among them an insert command, update
command and delete command. How does the method know which command to
execute? Does anyone know of a good online example of this code?

Any help would be greatly appreciated.

Thanks,
 
G

Guest

Thanks for responding; I appreciate it.

I'm using the following code to try to figure out what I'm doing. It is not
meant to be complete and certainly is not.
**********************************************
Public Shared Sub UpdateClaimForm(ByVal claimsFormData As DataTable)
Dim sqlQuery As New StringBuilder
sqlQuery.Append("INSERT SUP_CLAIM_FORMS")
sqlQuery.Append(" SET FORM_NUMBER = 'WB3',")
sqlQuery.Append(" FORM_NAME = 'My Form',")
sqlQuery.Append(" FORM_PATH_FILE_NM = 'WB3.xml',")
sqlQuery.Append(" FORM_STATE_CD = 'IL'")

' create an instance of the DB2Database class (Data Access
Enterprise Library) and DBCommandWrapper
Dim ClaimDatabase As DB2Database =
DirectCast(DatabaseFactory.CreateDatabase, DB2Database)
Dim UpdateClaimDataCmd As DBCommandWrapper =
ClaimDatabase.GetSqlStringCommandWrapper(sqlQuery.ToString)
Dim trans As IDbTransaction =
ClaimDatabase.GetConnection().BeginTransaction()

' update dataset
Dim ds As New DataSet
ds.Tables.Add(claimsFormData)
ClaimDatabase.UpdateDataSet(ds, claimsFormData.TableName, ???,
UpdateClaimDataCmd, ???, trans)

UpdateClaimDataCmd.Dispose()
End Sub
**********************************************
 
G

Guest

I don't know what you mean by an experimental/community project. I am an
ASP.NET developer for an insurance company in the Midwest. We use DB2
databases.
 
M

mnichols

I mean the libraries are not a core part of ASP.NET.

They appear to be a community project from gotdotnet and the docs have
not been written yet. Nothing wrong with that except that I have no
experience with the project.

best of luck.

mnichols
 
G

Guest

Thanks. Appreciate your posts.
--
Joe


mnichols said:
I mean the libraries are not a core part of ASP.NET.

They appear to be a community project from gotdotnet and the docs have
not been written yet. Nothing wrong with that except that I have no
experience with the project.

best of luck.

mnichols
 
J

Joerg Jooss

Thus wrote Joe,
Hello All:

I am trying to use the Enterprise Libraries created by Microsoft to
update a DB2 database and am stuck. I need to be able to Insert,
Update and Delete records from the DB2 datbase tables. I can use the
UpdateDataSet method to do this, but I am not sure how to use it. I
have Googled the method and haven't relly found anything helpful.
Here's one question:

The method takes several parameters, among them an insert command,
update command and delete command. How does the method know which
command to execute? Does anyone know of a good online example of this
code?

The idea is that for each added row, insertCommand is called, for each updated
row updateCommand is called, and for each deleted row deleteCommand is called.
The DataSet keeps track of all these changes. This behavior is restricted
to one table in the DataSet, therefore you have to pass the table name as
well.

See "Walkthrough: Using a DataSet to Update a Database" in EL's help file
for more details.

Cheers,
 

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

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top