Thursday, February 28, 2008

VS 2005 ASP.NET GridView Give "Failed to enable constraints. One or more rows contain values violating non-null, unique,.." Error

Note: There is a later post on this: http://devnote.stokemaster.com/search?q=enable+constraints Please read that first.

Symptom:


You created a web page with a GridView using a DataSet designer. You had a simple or a bit more complex joins in the table. Then one day, it stops working with an exception of:

"Failed to enable constraints. One or more rows contain values violating non-null, unique..." error.

You do know the target schema changed so you tried to re-configure the query but you still get the same error after re-compiling the dataset and associated DataAdapter.


My Root Cause:

This has happened in my case where the database schema changed drastically. After investigating the automatically generated code the failure occurs when filling the DataTable.

It also happend again much later when someone has changed the Field Size of a column too.

This meant that the the Query worked OK, but the DataTable did not get the necessary schema change.

What Fixed It:

Unfortunately I had to get rid of the entire DataAdapter associated with the query, rebuild the DataSet and then re-bind (re-cofnigure) the ObjectDataSource that binds to the GridView. The key here is that just configuring the query in the DataSet is not good enough, because the associated DataTable does not get the change of the schema and it will exception when the returned row set gets filled in.

Time Wasted:

I was at it for about two hours.

Monday, February 25, 2008

Microsoft SQL 2005 Mirroring with No Domain (Hint Only)

Problem

Micorosft SQL 2005 provides database mirroring with automated fail-over (if you are using a witness server). This is really a great feature and I use it quite a bit at work. But sometimes we don't have a domain controller.

Can we do Mirroring without a domain controller?

Solution (Hint):

Yes you can! You can use the Certificates authentication. This is described in the MSDN article entitled.

How to: Allow Database Mirroring to Use Certificates for Outbound Connections (Transact-SQL)

at this URL http://msdn2.microsoft.com/en-us/library/ms186384.aspx

You can also find this information on SQL Books Online (BOL) on your SQL Server Management Studio at the local URL of ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/udb9/html/49239d02-964e-47c0-9b7f-2b539151ee1b.htm (To type in this URL, bring up the Index part of the help manual browser where you will see the URL field.)

We were able to get this configuration up and running, but there were two things that we ran into that stumbled us a bit.
  • Initially the clocks of two machines were quite a bit off. This causes a havoc with certificates.
  • Even though we did not have to rely on the Domain Controller, we still had to add the Fully Qualified Domain Name (FQDN) of the servers in our DNS server.

Tuesday, February 12, 2008

VoiceMail Attachment Does Not Play on Windows Mobile/Smartphone

Symptom:

You have a voice mail system that can send out .WAV files as email attachments. The attachments play properly on Windows and Mac desktop computers (such as Windows Media Player), but if you try to play it with Windows Mobile or Windows Smartphone editions, you get "Invalid Format" error and the sound does not play.

Issue:

It is very likely that your voice mail system encodes the WAV file requiring a special CODEC. For example, I have a SpeakEasy VoIP service and this service (and great many of other VoiceMail system vendors) encode the WAV file using IMA ADPCM format (i.e., not all the WAV files are coded the same, the most basic one is the PCM, that will and do play on Windows mobile devices out of the box.)

Fix:

Install a third party sound player that can decode and play WAV files in IMA ADPCM format.
One such that I have found so far is PocketPlayer (30 day demo, approximately $20.00 purchase) and it worked fine with the SpeakEasy voice mail attachments. http://conduits.com/download_cabs.asp?product=Pocket+Player+3.51

So far I have not found any specifics from Microsoft web site about how you could provide a CODEC plug-in, in its Media Player. In fact Microsoft does not distribute Windows Media Player for Pocket PCs. That's left up to the device manufacturer. This probably has something to do with giving the manufacturer the ability to cripple some of the features they don't want for their users to have.

Friday, February 01, 2008

ActiveSync 4.5 Support Code 85020006 and 80072f7d

Symptom:

I just updated (in January 2008) my AT&T HTC 8525 phone's Windows Mobile 6 OS. Since then I was not able to sync with my host PC.

I get two errors:

Issue 1: Support Code:85020006
Issue 2: Support Code:80072f7d

Fixes:

Note that this involves registry changes so be careful with it.

Issue 1 can be fixed by;
  • Open ActiveSync
  • Choose File->Connection Settings...
  • Change "This computer is connected to" to The Internet
After you fix above issue, try the Sync and you may get the second error.

The second one is nastier and requires a registry hacking on your Windows XP PC (i.e., not the phone). I suggest that you save current registry settings before you do this.

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows CE Services]
"AllowLSP"=dword:00000000

This site has the registry file that you can double click and modify.

http://www.pocketpcfaq.com/faqs/activesync/LSPvalue.reg

This disables the Layered Service Provider (LSP) that use the Windows TCP/IP stack. But by doing this, you are going to forfeit the support rights from Microsoft.

After doing above two things, all the issues were resolved for me.

Time Saved:

This can save you at least 1 hour of hunting. These are not described in Microsoft web sites clearly.