Update requires a valid UpdateCommand when passed DataRow collection …

Posted by Troy on October 29, 2009 under .net, Microsoft, csharp | Be the First to Comment

 

I have been creating an application for work over the last couple of days which requires ADO.Net.  I work in the Business Intelligence field so I do not code verify often unless I need a custom script for an SSIS package.  Most of the Microsoft BI products just require a solid understanding of SQL or MDX and of course the customers business requirements.   While creating the application I ran into the following error when updating the databases with changes in the dataset.  I am using Visual Studio 2008 Express Edition and the database is a Compact Database. 

I only received the error when I tried to update a record in the database.  If I added a new record (INSERT) and saved my changes the application worked fine.  Below is a screenshot of the simple app:

image 

When you hit the save button it executes the following code:

try
{
 
this.Validate();
  this.rulesBindingSource.EndEdit();
  this.rulesTableAdapter.Update(this.ruleEngineDataSet.Rules);

  MessageBox.Show("Update successful!");

}

catch (System.Exception ex)
{
  MessageBox.Show("Update failed:\n" + ex.Message + "\n" + ex.StackTrace );

}

I placed a breakpoint on: this.Validate(); line.  When I ran the program  the program failed on: this.rulesTableAdapter.Update(this.ruleEngineDataSet.Rules);.  Below is a print screen of the message:

 

image 

The issue is with the TableAdapter.  There was no UpdateCommand (which is mentioned in the error message) or DeleteCommand for the TableAdapter:

 image

Create a new UpdateCommand by click (new) in the dropdown box.  You can use the query designer to create the update statement for the CommandText property:

image

Once the the CommandText property was set for the UpdateCommand the program worked. Below is a link to the issue found on msdn forums:

http://social.msdn.microsoft.com/Forums/en-US/Vsexpressvcs/thread/6d4de721-7571-49ca-a1fc-8689ec19a94e/

Troy

Sharing Your Blog on Windows Live

Posted by Troy on July 12, 2009 under Blogging, Microsoft, Web | Be the First to Comment

 

In yesterday’s post as I was walking through the Windows Live Writer configuration and there was a step that allowed you to add your blog to your Window’s Live site (you need to have a Windows Live account for this).   When I tried sharing my WordPress site it failed.

The reason it failed is that blog was not set up as a feed.  To fix the issue I used feedburner to set up the blog as an RSS 2.0 feed.  Once it was set up I was able to share my WordPress blog on my Windows Live Profile page:

share_windowslive

The area highlighted in yellow shows my last post.

 

Troy

Using Windows Live Writer with WordPress

Posted by Troy on July 11, 2009 under Blogging, Microsoft | Be the First to Comment

 

Windows Live Writer is a great tool for writing and posting your blogs.  Creating a blog post using the WordPress online interface can be cumbersome especially if you need to add images and tables.   It also allows you to write when you do not have internet access. 

While writing your post you can easily toggle between edit, preview and source (html view).  It also allows you to set the publish date of the blog.   This feature is useful when you want to write a series a blogs in one sitting and then publish them a few days a part instead at the same time.

Liver Writer Preview Mode:

LiveWriter_Preview

Configuring Liver Writer with WordPress:

Here are some screen shots on how to configure your site:

LiveWriter_AddBlog

  • Enter the address and the username and password for the site
  • For example my address is : http://troyscott.ca

LiveWriter_AddBlog2

  • Wait while it tries to setup your site
  • This can take a couple of minutes

LiveWriter_AddBlog3

  • Once your blog is set up click Finish to start blogging

On the last setup page there is an option to Share your blog on Windows Live.  I tried setting this up but I couldn’t get it to work.  It may be because my WordPress site is self hosted.  Let me know if you experience the same issue.  Here is the error I received:

We can’t get your information for this web activity. Make sure the information you entered is correct, and try again.

WindowsLive_Blog_error

 

Troy

Windows Live One Care - File and Printer Sharing Issue

Posted by Troy on January 25, 2009 under Microsoft | Be the First to Comment

I have been using Windows Live Once Care for about a year now and I am impressed with the product.  It is easy to install and setup file and printer sharing.  Until recently this worked well.   It looks like there has been an update to the product which provides tighter security around file and printer sharing.  If I turned off my One Care firewall the file and printer sharing works fine but if the firewall is on it does not work.    However , don’t disable your firewall to test this out unless you have a router that protects your network.  If you want to try this make sure you are not connected to the Internet.

Thanks to the post below I was able to get local network sharing working again:

http://social.microsoft.com/Forums/en-US/onecareprintersharing/thread/8258915e-c350-4802-8cc9-0c60b5322193/

Read the second post by Stephen boots to get the details.  To summarize, you need to set your local network to the Home and Work Zone (not Public)  and open the ports for Inbound and outbound ICMPv4.

Troy

Installing Google App Engine SDK on Windows

Posted by Troy on April 12, 2008 under Google, IT, Microsoft | Read the First Comment

Installing the Google App Engine SDK for Windows is fairly straightforward.  You can download the SDK here.   Before installing it on Windows make sure you have python 2.5 installed:

http://www.activestate.com/solutions/python/

It is a free download from ActiveState.  The Google App Engine SDK install will fail if python is not installed first.

image

By default the installer will install python in C:\Python2.5\ .  Once the install is complete double click on the Windows Installer application for the SDK (GoogleAppEngine.msi).

image

By default  it installs the SDK in :

C:\Program Files\Google\google_appengine\

But I prefer to have it installed at:

C:\google_appengine

image

After you set the directory for the SDK the installer should complete.  Now you can go to the command line and go to the google_appengine directory.

image

The SDK comes with a simple application called guestbook.  To see if your installation succeeded type the following from the google_appengine directory:

> dev_appserver demos/guestbook

You will then be prompted to check for updates on startup.  Respond “n” for the test.   If you have a firewall like Windows OneCare you may be prompted to allow python.exe to access the Internet.  Click “Allow this program”.

image

You can now access the guestbook application by going to your browser and entering:

http://localhost:8080

image

Type something in the text box and click the button to try out the guest book application.

Troy