2010-11-18

VS 2010 Cannot Write Updates to Schema Model Version

So… I started today creating the same sort of SQL Server Database project that I’ve done many times before.  Really simple database – just one table so far.  It’s just going to be a log for a new interface between our ERP system and the new time/activity tracking system being installed.

schema1

The first indication that something was wrong is during the Data > Schema Compare.  After selecting Project vs. Database, I noticed the [Write Updates] button is disabled.  And a friendly looking message informing me that I can’t do what I planned to do next.

“You cannot write updates to the target when you compare the specified types of schema models.”

error1

To date, the Google results haven’t been much help for this error message.  A few hits on queries, but only one solution – from someone accidentally using the Data Tier Application Component project instead of SQL Server 2008 Database project.  DAC projects cannot write updates.

I spent a little more time pushing and prodding VS 2010 and I finally got this error message out of it as well:

“SQL01275: The version of the source and the target schema do not match.  You can compare these schemas, but you cannot write updates to the target schema.”

error2

Okay – fine.  Searches for “SQL01275”, “version of schema do not match”, etc. were turning up nil.

I tried comparing Database vs. Database – no problem: [Write Updates] was enabled.  Proof: the functionality can still work.

I tried comparing Database file (.dbschema) vs. Database – again the error.  Taking this as a clue, I went to examine the .dbschema file.

<?xml version="1.0" encoding="utf-8"?>
<DataSchemaModel FileFormatVersion="1.2" SchemaVersion="1.1"
  DspName="Microsoft.Data.Schema.Sql.Sql100DatabaseSchemaProvider"
  CollationLcid="1033" CollationCaseSensitive="False">

Notice the 2nd line has another tip.  The schema version of my VS 2010 Database Project file is version 1.1.  Got caught in another red herring.  And finally posted this thread at MSDN Forums.

Jeff


UPDATE

Unbeknownst to me, I was importing a SQL Server 2005 database into a SQL Server 2008 Database Project.

Solution: In the Project > Properties, change the Project version to SQL Server 2005 and [Save].

project_version

Then unload and reload the database project.  Opening the Schema Comparison again, produces the expected result.

good

2010-10-20

Developing Mobile Applications for SAP

I skipped breakfast this morning at SAP TechEd 2010 to get to this hands-on lab (CD162) 40 minutes early. The hope was to get a no-show spot left by one of the approximately 50 registered attendees. One other person still beat me to the door. Right now, I'm second on the waiting list.





I made it!  Good lab too; it was worth the wait.  The important take-aways of this course were (1) learning how to use a set of SDOE_* transactions that are used to design the data structures and rules that are exported and consumed by the mobile application development environment; and (2) understanding how to consume the the published XML data structures in an application developed in Visual Studio C#.


Creating Distribution Rules
Transaction SDOE_WB is available in SAP Netweaver Mobile 7.1.  It is the Workbench used to create your distribution rules for mobile devices.  Here you indicate the data structures and configure rules used to determine what instances of those data structures are passed on to the mobile devices.


Developing on the SAP/Sybase Co-Innovation Stack 
After designing the data model to be consumed by the mobile application, you will need to export the model as an ESDMA bundle.  This is used by the Sybase Unwired Platform (SUP) to generate code in C# or Java (possibly others).  The generated code handles passing data and messages between the mobile device local database and the SAP backend database.  This allows you, the developer, to focus on the mobile application's business logic and design.

Looking forward to my first project.

UPDATE: I've since learned that there is many different ways (released and unreleased) to do mobile development.  Most of which are complicated at best.  The post above is just one small piece of one way to get a mobile application up and running.

2010-10-19

SAP TechEd 2010 Keynote

Vishal Sikka presented the keynote session at SAP TechEd 2010 in Las Vegas. The important take-aways for me were:

SAP Netweaver 7.3 Release
Information about the upcoming release of SAP Netweaver 7.3.

Coalescing mobile application strategy
A presentation was given on a 2-minute development project published to an iPad using the Gateway Consumption Toolset.  Looking forward to attending additional sessions this week regarding mobile development.

I had a conversation with an SAP Labs technician to learn more about this.  This is a device (think Google Search Appliance) that contains the hardware and software in one appliance.  It integrates well into existing system landscapes in that it can sit next to an SAP R/3 and/or SAP BW system and replicate a predefined set of data from either or both systems to be presented to end users in an in-memory, high-performance method.


2010-06-25

InteropServices.COMException (0x800A03EC): Microsoft Office Excel cannot access the file

I've been working on a problem for the past half a day with the MS Office 2007 PIA.  The issue is with MS Office automation on Windows Server 2008 (x64).

This statement fails:

                wb = (Excel._Workbook)(books.Open(_sourceFilename, 0, true, missing, missing,
                                                 missing, true, missing, missing, missing, missing,
                                                 missing, missing, missing, missing));
with error:
System.Runtime.InteropServices.COMException (0x800A03EC): Microsoft Office Excel cannot access the file ''. There are several possible reasons:

• The file name or path does not exist.
• The file is being used by another program.
• The workbook you are trying to save has the same name as a currently open workbook.
   at Microsoft.Office.Interop.Excel.Workbooks.Open(String Filename, Object UpdateLinks, Object ReadOnly, Object Format, Object Password, Object WriteResPassword, Object IgnoreReadOnlyRecommended, Object Origin, Object Delimiter, Object Editable, Object Notify, Object Converter, Object AddToMru, Object Local, Object CorruptLoad)
The solution is an odd one: create the directory "C:\Windows\SysWOW64\config\systemprofile\Desktop".

That's it.  Works like a charm.

2010-05-05

Windows SharePoint Search Access Denied

This is a re-post in order to make the solution to this error more transparent.  The problem was that our SharePoint Search service was not returning any results. I found the following event occuring in the Event Viewer.

================
Event details:
Event Source: Windows SharePoint Services 3 Search
Event Category: Gatherer 
Event ID: 2436
Description:
The start address cannot be crawled.
Context: Application 'Search index file on the search server', Catalog 'Search'
Details:
Access is denied. Verify that either the Default Content Access Account has access to this repository, or add a crawl rule to crawl this repository. If the repository being crawled is a SharePoint repository, verify that the account you are using has "Full Read" permissions on the SharePoint Web Application being crawled.   (0x80041205)
================

This stumped me for a long while until I finally took the time to dig in and do the proper research.  I found another error showing in the SharePoint log file:

================
CSTS3Accessor::GetDocFormat: Return error to caller, hr=8007007A - File:d:\office\source\search\search\gather\protocols\sts3\sts3acc.cxx Line:654
 ================

A simple Google search turned up this post by Yorick with the solution.

Thanks Yorick.

2010-03-29

IE8 Navigate in "Protected Mode"

If you spawn an IE session in your development read on…

I have an application that is posting data to a webpage from a client app using the IE.Navigate API.  The problem was that in IE8, the server never received the request.  Instead (when Visible was set to True), the window just opened and then disappeared.  I finally discovered the reason.

In the “Internet” zone, the “Enable Protected Mode” setting was checked.  An admirable security feature, it can be awfully annoying to the uninformed (as security features typically go).  Now, note that my URL is on our Local Intranet.  Regardless, by unchecking this option, the application immediately began functioning properly again.

Good luck with your IE8 testing.

2010-01-07

Excel's Extended Worksheet from Native Worksheet

The Setup
I recently had a request to create a simple way (user's perspective) to access and modify a SQL serer table directly without having to connect via the SQL Server Manager and navigating to the Database > Table > Edit.  After giving it some thought I decided to use VSTO to create an Excel interface to the three tables we needed to connect to.


This turned out to be an excellent choice.  90% of this project was simply "plumbing".  Hooking up the TableAdapter to the tables, generating a couple Get methods, an Update and a Delete method.  Finally implementing the SelectionChange event to determine when to update the record.


The hang-up came when I attempted to make use of the Ribbon Designer to provide a couple of user-interface options: one to switch from test to production systems and another to delete the selected record.  The system change was fairly simple once I learned how to export the Ribbon XML and implement the Callback method for a RibbonComboBox control:
  public void comboSystem_TextChanged(Office.IRibbonControl control, string text)
For a full list of prototypes for various Ribbon control events see the list at MSDN here.


The real problem was with the Delete routine.  With three different worksheets that could potentially have been active I needed some way to determine on which table to call the DELETE statement.  I started by creating a C# Interface by which my VSTO Worksheets must abide: ITableSheet that contained just two methods (RefreshData and DeleteRecord) and implemented them appropriately for each of the three Worksheets.  I thought that if I could access the ActiveSheet from the RibbonButton click event, then of course I could simply cast it to an ITableSheet and call DeleteRecord.  This provides an easily scalable way of adding new tables later, should that be necessary.


The Problem
Here's where I learned the difference between the native worksheet (Microsoft.Office.Interop.Excel.Worksheet) and the extended worksheet (Microsoft.Office.Tools.Excel.Worksheet).  It so happens that the ActiveSheet property is a native Worksheet object.  This is not easily cast to a VSTO (extended) Worksheet object.


And here's where the solution gets a little messy.


VSTO 2005: there's an alleged "unsupported" way to make this conversion.  That is to add a method called "GetExtendedWorksheet" to your project.  You can see a discussion on the topic here.  And you can find an example use of it here.


VSTO 2008: Unfortunately, Microsoft prevented this method by removing access to the RuntimeCallback object in VSTO 2008.  This is the version of VSTO that I was using.  A short discussion can be found here.




The Solution (for now)
The work-around that I implemented was to create an ActiveTableSheet property in my ThisWorkbook of type ITableSheet.  When a new worksheet becomes active I manually set the ActiveTableSheet.  Then during the RibbonButton click event, I can access Globals.ThisWorkbook.ActiveTableSheet.DeleteRecord.


The Real Solution (VS 2010)
The good news is that Microsoft appears to be providing a fully supported method of converting the native worksheet to an extended worksheet in VS 2010.  (This is beta and is subject to change.)