Daily Archives: August 9, 2005

Some breadcrumbs for getting SqlDependency working as a non-admin

I will get this to work! Currently I have to be logged in as an administrator to get SqlDependency to work. I have tried giving a variety of notification related permissions in the database to my lowly user login, but to no avail.

I just came across this – oh, what a shocking place to find the info  in the documentation for VS2005! 🙂 I must have come across it early on before I understood what the heck I was reading. Now it makes sense to me though and these looks like some good clues!

Security

The dependency infrastructure includes a client-side listener that is contacted by the server to send notifications. This listener is protected by Code Access Security attributes and by authentication. For more information, see SqlNotificationPermission Class and SqlNotificationAuthType Enumeration.

Code Access Security Assertions

The listener infrastructure enables the listener to listen on TCP ports or HTTP ports depending on which system is running. To use the listener, which is necessary to use SqlDependency, the caller must have SqlNotificationPermission. The use of the SqlNotification request is independent of the dependencies and listener infrastructure on the client. Therefore listener permission is not required.

I know that I did grant Query Notification permissions to my lowly user account ( as a test) and also QueryNotifcationErrorsQueue as the exception instructed me to. I also opened up some of the recommended array of ports (which at the time was supposed to be a bit of a hack fix).

Still I never got it working.But I am definitely adamant about succeeding at this! So I will be sure to post my solution when I get there.



www.acehaid.org

Girl Day

I had the most fun interruption today. Four of the girls who live on my street (ages about 8 – 11 and two are only visiting) wandered up my driveway in hopes of playing with my dogs. You have to understand, I have no kids, so there is never enough of this in my life. I allowed myself a good two hour break while we played with the dogs, drank pink lemonade, brushed the dogs and cat and naturally, all four of them drew pictures and practiced their handwriting on my tablet pc. Ahhh summer. 🙂

They promised to come back when the heat wave breaks to come bake cookies with me. That is *my* idea of fun!

www.acehaid.org

Saying the wrong thing at the wrong time

Once upon a time, my mother was flying somewhere – long flight, maybe cross-country. When she got on the plane, she was really tired, found her seat and fell right asleep. At one point she woke up and the person in the seat next to her offered her a newspaper. WIthout looking up, she said, “oh no thanks. I’m so tired, it would make me cross-eyed to read right now.” The man retracted the paper, got up out of his seat, gathered his things and as he went up the aisle to request another seat looked back at my mom. Of course, he was cross-eyed.

This is not a joke or an urban legend. It’s a true story. And I’m afraid it might be a family jinx. What’s worse for me, is when you are trying to make someone feel better, but still saying *just* the wrong thing and only making it worse. It takes me a while to realize that it’s time to just shut the heck up.

This happened years ago on a week long cycling trip in the colorado rockies. There were1600 riders of varying skill. At one point, I was climbing up a mountain pass road and passing someone – a woman who was probably a good 20 years older than me. But hell yeah, she was rockin’ on up that mountain. I always felt bad passing people (because it sucks when people pass you and you are working as hard as you can). I said something as I passed that I had completely meant to be encouraging. I probably should have either said “hello” or just nothing at all! The woman was a complete stranger and whatever words I chose had a very different meaning to me. She approached me a few days later and was very aggressive in telling me how I much had insulted her. She actually made me cry. (Though I didn’t do that in front of her) I was trying to be nice and a) made her feel bad (which I truly hated since it’s something like my job in life to try make people happy) and b) got yelled at for being a bad person. This was six years ago. It still upsets me. On the same trip, I did have a few women actually thank me before they went home for one thing or another I had done during the week that had meant a lot to them. But it’s that one woman who I made feel bad, bad enough to really give it to me, I will never live down. Rich says I’m ridiculous to let stuff like that bother me, but it’s just my nature.

Anyway, I guess sometimes it’s better to shut up since you don’t know a person’s entire story.

www.acehaid.org

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