Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to Update Not Bounded Fields
Message
From
12/01/2003 11:07:18
 
General information
Forum:
ASP.NET
Category:
ADO.NET
Miscellaneous
Thread ID:
00739818
Message ID:
00740785
Views:
31
Stephane,

All changes in a DataSet are stored in the DataSet itself, so it doesn't matter that it's disconnected. The CommandBuilder doesn't listen for events. You use it when you first set up your DataAdapter and the SelectCommand (the CommandBuilder will simply build your Insert, Update and Delete commands). It's when you issue the da.Update() that the DataAdapter decides, based on the RowState of each row in your DataSet, what needs to updated, inserted or deleted.
~~Bonnie


>Bonnie,
>
>The CommandBuilder included in .NET, to what is understand of it is listenning for events and build the sql statement as the data is changed. That's good but it simply doesn't work with disconnected Datasets sent to the client in an n-tier design. When a client returns a Dataset, there is no easy way like in old ADO to just reconnect the RecordSet and call the UpdateBatch method. I just don't get it why MS left this out of ADO.NET.
>
>Keep in mind i'm still learning the framework. Let me know if my understanding of it is right or wrong.
>
>Thanks.
>
>>Stephane,
>>
>>No, it's not really about security, that was just something I threw in there. Since we are not writing in-house software, we really have no control over our user's SQL Server databases. We can *suggest* that they restrict database access at the SP level, but they can do anything they damn well please with their data.
>>
>>As far as what you're thinking of doing ... what exactly would your builder give you that CommandBuilder would not? Just curious ...
>>
>>~~Bonnie
>>
>>
>>>Thanks a lot for your replies!
>>>
>>>So it's only about security? My vue on security is way more restrictive, only the server application have access to the database, the user cannot even get to the database (there isn't any route to it) So the only way to access the DB is to call one of the application server function which will then update (or not) the database.
>>>
>>>So i guess (correct me if i'm wrong) that creating a generic SqlStatement builder would be a valid choice in my situation ?
>>>
>>>I'm thinking of something like this:
>>>
>>>
>>>MySqlBuilder builder = new MySqlBuilder( dataset );
>>>// This would return a complete sql statement
>>>// With any Delete Update or Inserts
>>>string sql = builder.GenerateSql();
>>>
>>>
>>>Does it make sense or i'm just looking for trouble?
>>>
>>>>We just think that all user access to the database should be through SPs. You can set up your SQL Server to only allow access to users through SPs, giving the database further security (don't ask me how to do this, I'm not an expert on all the SQL Server details).
>>>>
>>>>As far as the CommandBuilder goes, if you have a DataSet that is fairly complex and the SQL to get this data is more than a few simple SELECTs, then there is no way the CommandBuilder can generate any code for you. We have lots of DataSets in our app like this.
>>>>
>>>>I suppose there are other reasons, but it's early Saturday morning and I haven't had my coffee yet ... can't think straight until then. <g>
>>>>
>>>>~~Bonnie
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Reply
Map
View

Click here to load this message in the networking platform