in a network-winforms-application based on a access database I've got the following problem:
user A starts software user B starts software
user A deletes row in db
user B changes data
application of user B makes an update dataadapter.update(datatable).
Now I get an concurrency violation.
Now I try to handle this error - what I want to do is simply refresh user B's datatable with datadapter.fill(datatable). But nothing happens - the datatable is not updated.
I already tried .clear before update - without success. Can you help me with this issue please?
August 2006 Archives
I saw this question on a public newsgroup. It's great fodder for the latest question of the day...
> Ok I have a VB.NET 2005 application that is connecting to a SQL 2005
> database. The application itself is going to go out and run SP, Views, etc.
> The users will be able to update records.
> My main concern is I do not want the user to be able to go out and Access
> the very same SQL server independent of the VB.NET program. What is the
> prefered method to allow users to use the VB application but absolutely no
> direct SQL database access?
Setting up application security is not that hard. First, make sure that the base tables and other objects in the database are not exposed to anyone--just the System Administrator account (SA). Protect the SA password and make sure it's not "password". The following strategy uses SQL Server Mixed-Mode security which is disabled by default--you'll have to enable it using the SQL Server Surface Area Configuration tool.
Unfortunately, I think Microsoft has stepped off on the wrong foot as far as the marketing of the SQL Server Everywhere edition. For obvious reasons, I expect they wanted to leverage the popularity and reputation of its deadly serious SQL Server DBMS. This makes sense, but technically, SQL Server Everywhere (SQL Ev) is not SQL Server (like SQL Server Express or the other paid editions). I’m of the opinion that if you name a product, it should bear some resemblance to that product. Each product name carries with it the baggage (negative attributes) and benefits (positive attributes) of its namesake. Calling something SQL Server when it’s not is deceptive and can be confusing when one assumes that it’s a clone of the predecessor or parent product. This also means when the customer gets the product and opens the box, they’re often disappointed when it does not look, taste or smell like what they expected. It’s like selling plastic “chocolate-like” bunnies to kids at Easter. As soon as they take their first bite on the left ear, they’ll know the difference—and you’ll regret it. No, I don’t mean to imply that SQL Ev is not edible, er, suitable because it is. It’s a perfectly good DBMS engine that can take on quite a few important responsibilities when it comes to storing, managing, fetching and replicating local data stores. It’s just not SQL Server and should not be expected to have the same feature set.
Perhaps this entry should be titled “Driving off the road with Microsoft Streets and Trips” ‘cause I nearly did drive off the road trying to use the 2006 version while on a number of recent trips. I would call myself a self-styled expert on automobile navigation systems. I must have purchased a half-dozen GPS automotive navigation systems since their first introduction. All along the way I’ve passed comments back to the manufacturers in an attempt to make these system work better for me and all of us. This article discusses Microsoft’s contribution to the fray.
A developer asked the newsgroup this week about a problem he was having with the CommandBuilder and its inability to generate SQL to fetch the newly created Identity value post Insert. His suggestion was to run the query, call RefreshSchema and subsequently fetch the new Identity.
Nary a week goes by without a reference to the CommandBuilder. Keep in mind that Mike P at Microsoft renamed this the “CommandDon’tUseBuilder”. This class is called by the DataAdapter and TableAdapter Configuration wizards to generate the source code that’s added to your project—at design time. That’s the critical point—this generated code is folded into your project as source code. Can it be used at runtime to generate action commands? Sure. Does it make sense for a serious application? Rarely.
I saw this question in the microsoft.public.vb.database newsgroup this morning and since I wanted to start a “question of the day” series of blog entries, I thought this was as good a candidate as any.
I am having some problems with Visual Basic 2005 Express Edition and databases. I have tried three different pieces of code (one I made that executes an INSERT command on a SQL database, another sample project from Microsoft also using SQL, and finally one from VB 2005 EE for Dummies using an Access database) on two different computers but none of the databases saved. I have never worked with databases before, but I followed all the instructions exactly for the samples I used. I could see the information was in the dataset when I ran one of the programs. It had multiple forms that displayed the information in the database in two different ways. When I modified the data in on form and clicked the save button and then went to the other form I could see the updated data. When I closed the forms and started the program all the changes were gone, however in the video that went along with the code I saw the code run just as it should, the data came back when he restarted the program. Am I missing something here? I don't see what I could have possibly done wrong. It does not make sense to me at all. HELP ME!!!,
According to this article Microsoft plans to further erode acceptance of Vista by not “supporting” any version of SQL Server other than 2005 SP1. This means existing SQL Server customers running older versions (the vast majority) will have a choice. Upgrade to SQL Server 2005 SKUs and bear the expense to redesign, recode, retest, and redeploy or not move to Vista. This is not that easy (as some might lead you to believe). Take MSDE for example. It supports replication subscriptions—SQL Server Express does not. The question is, what does “support” mean? Does it mean that Microsoft won’t let MSDE or SQL Server 2000 install on Vista? I don’t know—but I’m going to find out.
If you add to this the inability of many existing XP systems to upgrade at all (they require a new OS and complete reinstall of installed software) I foresee a dismal beginning to the Vista OS. Perhaps it’s really just a games platform designed for Betty and Bob consumer and the OEMs who want an OS that makes their existing platforms obsolete so they can sell replacement iron.
I met with Microsoft last week over dim sun where we chatted about what’s right and what’s wrong with the documentation and help system. I said that the search engine is just busted. When I ask for an in-context topic I still get flooded with irrelevant topics. If I add more information to narrow the search, it seems to widen the search. I guess I’m just spoiled by Google that seems to get it right far more often.
So, I revert to the index trying to find something that’s close to what I want. This works better but still there are topics where the work selected takes me to Cleveland when I wanted Boston—and who would want Cleveland anyway?
When in the IDE, I make the mistake of selecting the term to search for—this works sometimes, but other times I just get “Form” or a suburb of Cleveland again.
After the talk, Microsoft wanted me to give them specific cases where I get sent off into the ozone. I’m building a log of all of these hits in an attempt to get them to see what’s going wrong.
Incidentally, they said that all of those little comments we put at the bottom of help topics are being kept by the Visual Studio people—and not passed to the help writers. Sigh.
If you have problems finding stuff with help in Visual Studio 2005, could you post these issues here? I expect that everyone is working with Visual Studio in ways that are far different than what I’m doing. Let’s see if we can help them help us (so to speak).
We were conversing this morning about change in developer tools since the demise of VB6 Someone made the point that it's not the intelligence or experience of a developer that makes them sucessful, it's how long can they go before giving up in frustration...
My response was...
I expect that I’m as frustrated as anyone—perhaps more so. I agree with the assessment, but as I see it, experience can also be a hindrance and further contribute to my frustration. When an experienced developer attacks a problem with a new tool they first try the techniques learned when using the old tool. The problem is, the new tool (while it might have the same name as the old tool—or close—might not work in the “old” ways. After all, it’s “new and improved”—at least in someone’s estimation. People who have never seen the old version can be at an advantage. They don’t carry along the baggage of knowing how stuff used to work.
This problem won’t get any better until Microsoft stops churning just for the sake of churn—and they’re promising to do it even more often. Are a thousand little changes better than one humongous change less often? I’ll leave that up to you to debate. IMHO the answer is no, none of the above--especially when there are still outstanding issues with the last set of changes.
When someone blindfolds me and says they’re handing me a “coffee cup”, I expect to be able to reach out and be handed a vessel with specific properties. As of late, when it’s Microsoft handing me the cup, all too often I get burned and spill hot stuff on my lap.
As far as the books, instructions and training (and Microsoft documentation), these take time to create. My new book (in edit) talks about reporting and Windows forms, and data and SQL Server and how they connect and interact but it’s taken almost two years to write—only for it to be (at least in part) made obsolete by the next “new and improved” version.
Another comment echoed this: http://www.theaustralian.news.com.au/story/0,20867,19509645-36375,00.html