Sharepoint Designer Error: The data source control failed to execute the update command.

Ok so I searched Google/MSDN for DAYS on this problem, and I finally figured out why after piecing a ton of bits of advice together, plus a little ingenuity. A little background, first, however:

In Sharepoint Designer 2007, You have the ability to connect to a SQL Server 2005/2008 database. Whether you do it through Single Sign On (awesome blog post here) or directly through basic connection string (under Data Source Library-> Database Connections and then “Connect to a database” and “Configure Database Connection”, as shown below), it doesn’t matter; just connect successfully to the database.

Make sure in SQL Server you give db_owner or db_reader and db_writer permissions. Also, be sure your table has a Primary Key (id, guid column will work, autoincrement is a good idea too, but this is obvious stuff). Once you connect to the external DB, you should be able to see the Data Source Details (just like you would a list) by going to your Database Connection list and clicking “Show Data.” From there Data Source Details will pop up.

Then, if you want to allow users on Sharepoint to insert/edit/delete to the external Database, select all of the Rows and “Insert Selected Fields As….” and whatever you want; I always do Single Item View. Anyway, next you’ll want to highlight the Data Form Web Part and go to its properties by going to the arrow on the far left (Common Data View Tasks). Once there, click the tab on the far right called “Editing.” Check all boxes necessary including “Synchronize Commands” then click OK. Then, if you have permissions set up properly in SQL Server, you’ll be able to delete and insert, but when you try to edit, just when you submit, it will give you this lovely screen (click to enlarge):


Now, let me tell you, I tried EVERYTHING to remedy this, in SP Designer, SQL SERVER 2008, etc. Nothing doing. Why so? Well it turns out SP Designer, the great product that it is, writes the Update syntax incorrectly; for one reason or another it tries to overwrite the Primary Key setup in your database table. So if you search “UpdateCommand” in the code/split view of SP Designer, you’ll see a big long UPDATE command, depending on how many rows you have. Simply re-write this yourself! For example, I had this:

“UPDATE [test_table] SET [Name] = @Name, [Occuptation] = @Occuptation WHERE [id] = @original_id AND ([Name] = @original_Name or ([Name] IS NULL and @original_Name IS NULL)) AND ([Occuptation] = @original_Occuptation or ([Occuptation] IS NULL and @original_Occuptation IS NULL))”

And simply changed it manually to this:

UPDATE [test_table] SET [Name] = @Name, [Occuptation] = @Occuptation WHERE [id] = @original_id

(in SP Designer below)

 

This is a simple fix, and depending on how complex or simple you want your update command definitely is up to you and will vary. For me, this was pretty straightfoward. Then it just worked for me! Insert, Delete and Edit worked beautifully then. I’ve heard of hot fixes remedying this issue, but none worked for me so I just manually solved it. Anyway, this was a lot of text, so I’ll bullet point it out the best I can.

 

TL;DR: SP Designer’s Update command is broken, fix it by manually writing it!

 

If you have any questions, comments or opinions please comment below! I am so glad I can share this solution with others.

One of my favorite tools for Mac: MAMP

When developing, most of the time I will just upload my “sandbox” code somewhere on my ASO hosting. This is all fine and dandy, but what you have some super secret project? You certainly don’t want it to be available on the open web (nor on the DEEP WEB). In that case, it’s often best to use your local machine. If you go to http://localhost on your machine (or 127.0.0.1) you’ll probably get SOME page (it’s different with each OS). This is all well and good, but what if you want to set something separate up? For Mac, that’s where MAMP comes in. MAMP stands for Mac Apache MySQL and PHP. It’s a complete package! Starting and stopping a server has never been easier (without the need for command line). Just start MAMP up, fire the servers up and bam! Instant server. Want to route where your web files go? No problem! MAMP allows for directory changes so you can store wherever you want. I sound like I’m advertising, but I just enjoy the product (and hey, did I mention the basic version I use is free?). So if you have a moment, check out MAMP!

The Other Side of the Coin

Make Your WordPress Blog Map to a Different Domain

Awhile ago, I had multiple blogs on one hosting account, and I wanted to have:

http://hungrytapir.com – point to my development blog and

http://teacast.net – point to my video blog

 

But how can you do this if your domains are hosted elsewhere, like Namecheap or (ugh) GoDaddy? Easy! There’s 3 steps to this process that I’ll walk you through:

STEP ONE: Change the DNS Servers for your domain

I’m not sure how this works in GoDaddy (because they SUCK), but if you do it in Namecheap, it is under Domains->Manage Domains (that is, if you are logged in).

Then, head on over to Domain Server Setup

 

Then, you’ll see some spots where you can insert custom nameservers. I use A Small Orange, so my two nameservers are: ns1.asmallorange.com and ns2.asmallorange.com. Your hosting provider will have different ones than this (though in the past, I know many are usually ns1, ns2, ns3 etc .hostname.com). So, add those in the fields. Then step one is done! Oh and by the way, this change will usually take 20 minutes or so (at least, for me it did). To check the progress, check out dns.squish.

STEP TWO: Changing your Addon Domain in cPanel

Now, head over to your cPanel or whatever equivalent you have, and check out “Addon Domains.” Most hosting providers have cPanel, but if you have your own server, you can get it here. I don’t think it’s free though :( .

Anyway, check out “Addon Domains” under the Domains section

Then, put your credentials in for your blog. Remember, under Document Root, make sure it is your WP directory! Oh and don’t put a subdomain unless you really want one.

Then, click “Add Domain” and BAM! Only one more step to go.

STEP 3: Changing your WordPress domain

Here’s the easy part! Check out your WordPress Dashboard and go to Settings->General. Both WordPress Address and Site Address should be your domain that you put in AddOn Domains. That’s it! You may have to wait a few minutes or so for it to kick in, but for me at least, it worked instantly.

Questions? Feel free to comment!

 

TumblrToWordPress = AWESOME

Well I’m in the progress of converting all my stuff to WP and I didn’t want to have to copypasta everything from Tumblr to WordPress. Tumblr is great, but I needed something far more customizable for what I do. I found this great tool called TumblrToWordpress. It took like 4 seconds, all I did was download an XML file and use WordPress’s import tool. Worked like a dream!

easy jQuery -> Scroll to top with jQuery!

So, in getting more and more familiar with jQuery and other fun JS frameworks, I wanted to create something I have seen in the past: scrolling to the top and detecting when you are at the bottom. It’s really easy! I have to thank my buddy Brian for the inspiration; his site is where I first saw it. So, let’s cover the HTML first.

Here’s the style (nothing fancy, just large enough for a scroller):

 < style> div { position:absolute; background-color:#FFF; } #test{ margin-left:100px; height:900px; position:relative; } #bottom{ position:relative; } < /style> 

Aaand here’s the two divs I used:

 < div id="test">Blah Blah Stuff at the top< /div> < div id="bottom">< a class="gototop" href="#">Back to Top!< /a>< /div> 

Finally, here’s the jQuery to pull it all together:

 < script src="jquery-1.6.2.js">< /script> < script type="text/javascript"> $(document).ready(function(){
  $("#bottom").hide();

  $(window).scroll(function() {
   if($(window).scrollTop() + $(window).height() == $(document).height()) {
          $("#bottom").fadeIn();
   }
});

  $(".gototop").click(function(){
   $("#bottom").hide();
    $('html, body').animate({ scrollTop: 0 }, 'slow');
  });
}); < /script> 

Check out a basic demo here or on JSFiddle Of course, just because I used…

fadeIn();

there’s no reason you can’t use some other fancy jQuery animation. Questions? Feel free to comment!

My Educause 2011 Itinerary

This is mostly for my reference, but feel free to check out what classes/lectures I am attending. 

Educause 2011 Itinerary

    Wednesday, October 19th:

  • 8 AM: Seth Godin Speaks

  • 9 AM: Exhibit Halls Open/Refreshment Break in Exhibit Hall

  • 10AM: Open Source Evolution in EDU – Meeting Room 115C

  • 11:30AM: Web Portals [Discussion] – Meeting Room 203B

  • 12:30PM: Lunch in Exhibit Hall

  • 1:30PM: DIY To CMS – Modernizing SFU’s Web Presence – Table 73 Exhibit Hall A/B/C

  • 2:30PM: Performing Space: Foursquare and Digital Presence – 103C

  • 3:30PM: Innovation Trenz – 113A

  • 4:00PM: Refreshment Break in Exhibit Hall

  • 4:50PM: The iPad: Implications for Higher Education – Meeting Room 107A/B

Thursday, October 20th

  • 8AM: Using Agile with Koiale – Meeting Room 103A

  • 9AM: Web Professionals – Meeting Room 115C

  • 10:30AM: Privacy in the Era of Social Media – Ballroom A/B

  • 11-12PM: Lunch and Poster Sessions

  • 1PM: Mobile Learning: Applications That Change Distraction to Discussion – Meeting Room 113B/C

  • 2:30PM: Transforming Research in the Cloud – Meeting Room 111A/B

  • 3PM: Refreshments in Exhibit Hall

  • 4PM: You Need to go Mobile Now – Meeting Room 108A

Friday, October 21st

  • 8:30AM: Implementing a Sharepoint Portal: A Roadmap to Success – Meeting Room 202A

  • 9:30AM: Cloud Computing and Mobility – Meeting Room 102A/B

[Ruby on] Rails Route Root Trick

I’ve wanted to get into Rails for awhile now, but never had time to sit down and concentrate on it because of my CS theory courses and my WordPress studies.  Finally, I graduated and about a month or so ago I started getting into Ruby and now Rails. Anyway, I digress; I was working on a new rails project, as I am newer at it (special thanks to @jaybetts for his guidance and suggestions on moving to Rails), and I was having a good time, when I decided I wanted to change my root route in config/routes.rb. I was able to send it to my localhost:3000/controller[index] page, but I really wanted it to route to a specific page id (page 1 to be exact). Originally, Rails comments out the example root route:

  root :to => ‘welcome#index’

Ok, so this goes to the welcome index page. Great. But what if we want to go to page 2 or page 3 (if you have created any number of pages). Easy! 


  root :to => ‘pages#show’, :defaults => { :id => 1 }


And, you can specify any :id, as long as it is a valid page id! 
I searched ALL OVER the net to find the solution to something so simple, so I hope this gets to the top of Google search to help people :)

Sometimes I am too lazy to write, so I take pictures

I’ll be the first to admit that I feel like writing blog posts seems like more of a job than something enjoyable, so I’ll probably keep it to images of my fish, coral and tanks here. Feel free to follow! Picture blog… GO!

Rebecca Black – Friday (OFFICIAL VIDEO) (by trizzy66) FRIDAY!