473,804 Members | 2,124 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

entlib UpdateDataSet how to update the database?

Hi every body i new in dot.net and i am tring to update a table with a data
set using entlib i found the way to doit one by one but is any way to doit
in one command?

Code Sample

Dim dbCatalyst As Microsoft.Pract ices.Enterprise Library.Data.Da tabase =
DatabaseFactory .CreateDatabase ("CATALYST")

Dim sqlCatalyst As String = Me.sqlRecipient

Dim dbCatalystComma nd As DbCommand =
dbCatalyst.GetS qlStringCommand (sqlCatalyst)

Dim CatalystDataSet As DataSet =
dbCatalyst.Exec uteDataSet(dbCa talystCommand)

Dim CatalystTable As DataTable = CatalystDataSet .Tables(0)

'iseb

Dim dbISEB As Microsoft.Pract ices.Enterprise Library.Data.Da tabase =
DatabaseFactory .CreateDatabase ("ISEB")

Dim sqlISEB As String = "select * from tmpReportViewer "

Dim tmpReportViewer DataSet As New DataSet

Dim dbISEBCommand As DbCommand = dbISEB.GetSqlSt ringCommand(sql ISEB)

Dim tmpReportViewer Table As String = "tmpReportViewe r"

dbISEB.LoadData Set(dbISEBComma nd, tmpReportViewer DataSet,
tmpReportViewer Table)

Dim table As DataTable = tmpReportViewer DataSet.Tables( tmpReportViewer Table)

table = CatalystTable

Dim rowsAffected As Integer = dbISEB.UpdateDa taSet(tmpReport ViewerDataSet,
tmpReportViewer Table, Nothing, Nothing, Nothing, UpdateBehavior. Standard)
Sep 7 '06 #1
1 3546
PGC
Eduardo,

Your last line (dbISEB.UpdateD ataSet) has no DBCommand objects to do this.
They are set to Nothing, Nothing, Nothing. Normally you would use three
stored procedures (SQL), an insert, an update and a delete procedure.

e.g.
cmdInsert = dbISEB.GetStore dProcCommand("s p_myInsert")
''' Add your sproc parameters here! - see AddInParameter method
cmdUpdate = dbISEB.GetStore dProcCommand("s p_myUpdate")
''' Add your sproc parameters here!
cmdDelete = dbISEB.GetStore dProcCommand("s p_myDelete")
''' Add your sproc parameters here!

You would then replace the Nothing, Nothing, Nothing with cmdInsert,
cmdUpdate, cmdDelete. Note: If all you are doing is performing one type of
action (e.g. Insert) then you can set the others to Nothing.

BTW microsoft.publi c.vsnet.enterpr ise.tools would probably be a better
newsgroup to post EntLib queries.

Paul

"Eduardo Silva" <ed*****@eduard o.comwrote in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
Hi every body i new in dot.net and i am tring to update a table with a
data set using entlib i found the way to doit one by one but is any way to
doit in one command?

Code Sample

Dim dbCatalyst As Microsoft.Pract ices.Enterprise Library.Data.Da tabase =
DatabaseFactory .CreateDatabase ("CATALYST")

Dim sqlCatalyst As String = Me.sqlRecipient

Dim dbCatalystComma nd As DbCommand =
dbCatalyst.GetS qlStringCommand (sqlCatalyst)

Dim CatalystDataSet As DataSet =
dbCatalyst.Exec uteDataSet(dbCa talystCommand)

Dim CatalystTable As DataTable = CatalystDataSet .Tables(0)

'iseb

Dim dbISEB As Microsoft.Pract ices.Enterprise Library.Data.Da tabase =
DatabaseFactory .CreateDatabase ("ISEB")

Dim sqlISEB As String = "select * from tmpReportViewer "

Dim tmpReportViewer DataSet As New DataSet

Dim dbISEBCommand As DbCommand = dbISEB.GetSqlSt ringCommand(sql ISEB)

Dim tmpReportViewer Table As String = "tmpReportViewe r"

dbISEB.LoadData Set(dbISEBComma nd, tmpReportViewer DataSet,
tmpReportViewer Table)

Dim table As DataTable =
tmpReportViewer DataSet.Tables( tmpReportViewer Table)

table = CatalystTable

Dim rowsAffected As Integer = dbISEB.UpdateDa taSet(tmpReport ViewerDataSet,
tmpReportViewer Table, Nothing, Nothing, Nothing, UpdateBehavior. Standard)


Sep 7 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1391
by: tintin | last post by:
By using the EntLib config tool, we have to set the filepath at design time. I'm looking for a way to set path of the log file at a variable path because when i package and deploy my desktop application the trace.log file should be in the application path. How can i set a filename as the current date (something like 030305.log). So a log file created for a particular day can be identified by the date.
3
1673
by: Nick Zdunic | last post by:
I want to keep using 1.1 on EntLib on ASP.NET 2.0 but have found an issue with the <enterpriselibrary.configurationSettings in the web.config In Visual Studio 2005, when running there is a parse error. The message is something like this: Error parsing application configuration file at line ?. Type {http://www.microsoft.com/practices/enterpriselibrary/08-31-2004/configuration}ConfigurationSectionData' is not found in Schema. I'm not...
0
1036
by: R.middel | last post by:
Hi, I want to use Entlib in a combination with Azman, but I don't seem to find how this works. Can someone help me? I'm using AD and .NET 1.1 Thanks in advance, Rudi Middel
0
1313
by: Jesse Houwing | last post by:
Hey all, I've been asked for a customer to write a piece of data access using EntLib 2.0. I'd like to use the standard entlib database factory class because a transition to SQL Server is still a viable option in the near future. The problem is that the project will use Oracle till then, and there is no integrated security activated on the Oracle Server (and it won't be in the near future). For compliance reasons every user must connect
4
1360
by: =?Utf-8?B?TWlrZQ==?= | last post by:
The DBCommandWrapper class doesn't exist in Enterprise Library because it's properties/methods have been relocated to other classes. Where did the RowsAffected properties go? I can't find this property anywhere? I use this property when, for example, calling SQL 'Update' stored procedures. I call the procedure, and then evaluate the number of affected records to determine if the command completed successfully. Thanks.
3
3009
by: Abhishek Tripathi | last post by:
Hi, I am using a code similar to Database db = DatabaseFactory.CreateDatabase("MyDB") in every function of my DAL that interacts directly to database. But recently I have started getting connection pool errors. I think, it is because of incorrect usage pattern of Database Object of DAAB. I want to know that what should be the best approach to it. Shall
3
3580
by: rockdale | last post by:
Hi, all: My web application using MS EntLib for .net 2.0 (Jan 2006) to access my backend database. It works fine with MS SQL 2k. Now we are migrate from MS SQL to mySQL. Everything looks fine except one serious problem: we got the "too many connections" error. Looks like the EntLib did not properly close these connections. on mySQL Administratorserver connectionsThreads I can see a new thread created after a couple of...
1
1666
by: tracybannon | last post by:
Is it possible to use the ENTLIB Cryptography Block without using a keyfile. In addition to keyfile management my team is also concerned about performance. In this particular instance, we are using the cryptography block to enccrypt and decrypt query strings and the crypto block would see heavy usage. Any information or feedback is welcome. Regards, Tracy Bannon
0
970
by: Cesar Gazzo Huck | last post by:
Hi, I'm trying to use Mysql with enterprise library but i have a problem with somes methods becouse EntLib understand that mysql is a generic database. I need a sample using custom provider mapping with mysql? Thanks for all and sorry for my english, i am from argentina. César
0
9595
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10099
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9176
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7643
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6869
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5536
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5675
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4314
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3003
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.