Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DataSet and Calculated Field
Message
From
06/05/2009 18:28:06
 
General information
Forum:
ASP.NET
Category:
ADO.NET
Environment versions
Environment:
C# 3.0
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01398230
Message ID:
01398241
Views:
55
>For now it's too advanced for me. I have DS and tableadapters generated, so where should I put such code?

I have it after my SQL command has been done. This is just before returning the control back to the client. So, basically, because a property of my data adapter class has been put to lReadOnly = False, it means that the data adapter class will adjust the dataset before completed its process. So, once the client code continues, the dataset should be writable.

Here is an example:
            Dim loDataProvider As Framework.Framework.Data = New Framework.Framework.Data(oProcess)

            ' This is required for SQL Server to allow us to update a field from the dataset
            loDataProvider.lReadOnly = False

            loDataProvider.ParameterAdd("Numero", 1)
            If Not loDataProvider.SQLExec("SELECT Member.FirstName " + _
             "FROM Member " + _
             "WHERE Member.Numero=" + loDataProvider.ParameterAddSQL("Numero")) Then
                Return False
            End If

            ' Scan all the records to find the MAX(MitTelLogDet.Fic_Date)
            For lnCounter = 1 To loDataProvider.nCount
                loRow = loDataProvider.oDataView(lnCounter - 1).Row

                loRow("FirstName") = UCase(loRow("FirstName"))
            Next
Note that loDataProvider is an instance of my framework Data class. But, you probably have something like that already.

So, basically, in this example, I execute a very simply query to get the firstname of the Member record for primary key 1. Then, as the dataset is writable, I can loop into the number of records and apply a business logic. In this case, I simply uppercase the value.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Previous
Reply
Map
View

Click here to load this message in the networking platform