Category Archives: dotNET

RowState and adding, importing or merging rows

One of the many topics I cover in my ADO.NET 2.0 talk is about the ability to modify the rowstate of unchanged rows with SetAdded or SetModified. If you have never been in a position where you wished like crazy that you could change the row state, or if you don’t understand the semantics of DataRowState and how importing, adding or merging affects it, then these features don’t really make a lot of sense.

Moving datarows around is not the only time I imagine you might have a need to affect the rowstate, but I wanted to just point out a few of the nuances of moving rows.

When you add rows using the DataTable.Rows.Add method, the rowstate of the added row will be Added (regardless of what its’ original state was).

When  you import a row, the row’s current state will be imported with it.

Merge is the same as import in regards to the affect on rowstate. Merge just imports a whole bunch of rows at once. So, it, too, persists the row state.

In the demo I have for SetAdded and SetModified, I have two sets of data. One dataset coming from a local database and another coming form a web service. I append the 2nd set of data to the first using the Merge function. Then the next step is to update my database and I want the newly merged data to go in the database as well as any changes to the original set of data. In the demo, all of those new rows from the web service do not get uploaded because their rowstate was “Unchanged”. By using the Merge function, the rows were not flagged as “Added”. This definitely is a surprise to some people when I do that demo because many do not grok the differences between Import/Merge and Add.

Here is a Data Points column by Joseph Papa from a 2003 issue of MSDN Magazine that explains how rowstate is affected. After reading that, it might make more sense why having the ability to affect the state of the rows is a useful thing. SetAdded and SetModified are two functions that you do not want to use unless you definitely know what you are doing.

www.acehaid.org

Speaking at your own user group

I did one of my favorite talks (What’s new in ADO.NET 2.0) for my favorite user group (VTdotNET) last night. This is the 5th time I have done this talk since March and these guys and gals asked me questions that nobody had asked before (and I didn’t always have the answer) as well as made a lot of interesting observations. I learned a lot. I am excited about digging down a little further into ADO.NET. Because of the discussion, the session went way too long, which is fine for me (I can talk about this stuff all day and night) but really not fair to many of the attendees who get tired and can’t absorb any more after a while. The ability to have this type of interaction without a hard time constraint is what is really awesome about speaking at user groups vs. at conferences. But I think I have to figure out how to balance that a little more without having to cut the talk short.

It’s a broad topic with a lot of ground to cover, but I have actually had to do in one hour once. So I know it can be done!!

I got a very nice email from a first time attendee in which he said “It seemed clear to me that the community and the relationships you’ve built, are such that people are keenly interested in each other’s work and in each other’s learning.  From that aspect alone it’s a pretty remarkable users group.”

This is the kind of feedback that really makes being a user group leader extremely rewarding. And I think that all of the members should feel equally proud.

One big lesson that I have to remember: Have someone else be the user group leader for the night. It’s just too hard for me to run the meeting and focus on the talk as well. I needed someone to take care of me, make sure I had water, got fed, run the raffles, prepare and do the business meeting, etc. Next time! (Which may be next month if our tentative speaker, Dr. Neil Roodyn, is not able to trek all the way across the country in between PDC and the MVP Summit.)



www.acehaid.org

VB6 Upgrade Tour in Waltham Mass, Oct 5th

Methods and Masters: The VB Upgrade Tour  

Are you still using VB 6? If you are then this is something that you will want to attend. 

Visual Basic 6.0 developers have had a great tool – but it’s time to learn how to use those Visual Basic skills with the next generation of products.  Visual Basic .NET/2005 can help to make you more productive at the development that you do every day. Join Brian Randell for an evening session on getting those skills up to .NET.

Register Here 

Wednesday, October 05, 6:00 PM – 9:00 PM
Microsoft Waltham Office
 
Room: MPR A&B
201 Jones Road, 6th Floor
Waltham, Massachusetts   

www.acehaid.org

Christmas in July- Thanks Addison-Wesley

I received a box filled with books from Addison-Wesley today. The next meeting of Vermont.NET will be an ADO.NET blowout with Mike Soulia from Kiss the Cook & Apple Mountain doing the .NET Newbie session on ADO.NET and then I will be doing one of my favorite new talks: What’s new in ADO.NET 2.0. One of the books I have multiple copies of for the meeting is the beta2 version of the ADO.NET 2.0 & System.XML 2.0 book by my pals Alex Homer, Dave Sussman and Mark Fussell (who is now the program manager on the WSE team).

Because they are in Boston, A-W was also able to pull through on a fast box of books for the first meeting of CNY .Net Developers which is on Wednesday.

www.acehaid.org

VS2005 Short Checklist for ASP.NET, Web Services and WSE 3.0

Here are a few things that keep biting me when I return to working on a web services app using wse3.0. I have blogged about some of these before, but need to keep them in the front of my mind!

  1. ASP.NET Project NTLM Authentication: If NTLM Authentication is on and you are not set up to use it, you will get a 401 Unauthorized error (“The request failed with HTTP status 401: Unauthorized.”) when trying to start up a web page or access a web service.  This was a new project property setting as of Beta2.
  2. Using File System and not IIS? Check your port #.  When trying to hit a web service and the port # of the Development Server has changed, you will get an error message saying “Stream was not writable”. This happened to me when I moved a solution from one computer to another and I needed to change the port # in the web reference.  In an ASP.NET application you will get this message “No connection could be made because the target machine actively refused it” when your port # has changed.
  3. Permissions to read certificates Depending on your environment, a particular windows account will need READ access to the web server certificate. Normally, it would be the ASP.NET account. I found that when developing with a non-admin account, I needed to give that non-admin account access to the certificate (in a development environment). If you have not set this up properly, you will see a message indicating “Bad Key” in the soap fault when looking at the trace info. This will come back in the TraceInput of the client application. The Security Hands on Lab for WSE3 (found on this page) has instructions for setting permissions on certificates.


www.acehaid.org