Clinton's profileCherry BytesBlogListsGuestbookMore ![]() | Help |
|
Public folders
Cherry BytesClinton Cherry does dot net June 16 Generating SQL Scripts for DataAn issue I have always had is finding an easy way to generate SQL Scripts for moving data from one database to another. Obviously if you are doing a straight copy this is easy, however using only SQL Management Studio I was never able to find an easy way to get the data into a simply SQL script that I could give to a Database administrator for deployment.
Today I discovered a nifty commandline tool 'SqlPubWiz' that actually comes with SQL Server to do this.
Simply navigate on the server your database is on to the folder C:\Program Files\Microsoft SQL Server\90\Tools\Publishing\ and within this folder (or in one of the versioned subfolders) you will find a tool called sqlpubwiz. By running this at the command line and pointing this to your database, you can easily now generate the SQL scripts you require for your data.
ie sqlpubwiz script -d MyDataBaseName "C:\NameOfFileToGenerateScriptFo.sql" -dataonly
If you don't have the tool you can easily download it here: http://www.codeplex.com/sqlhost/Wiki/View.aspx?title=Database%20Publishing%20Wizard.
I found out about this on this great article at The Code Project - http://www.codeproject.com/KB/database/DatabasePublishingWizard.aspx. June 05 Validating that a checkbox has been selectedBeen doing heaps of stuff with jQuery lately, so thought I should start jotting down some of the more useable code that I have done. A really useful bit of code was adding validation to check if at least one checkbox is checked. The following bit of code does that really easily.
First you will need to create a simple custom validator for your page:
<asp:CustomValidator ID="valCheckBoxes" runat="server" ErrorMessage="You must select at least one checkbox" ClientValidationFunction="CheckAnyCheckBoxChecked" Display="Dynamic"></asp:CustomValidator>
Once you have the validator, make sure that it has a ClientValidationFunction. You will then need to create this method. Using jQuery you can easily search for any checkbox that is checked. If none are checked, then throw the validation exception. Easy!!
<script type="text/javascript"> function CheckAnyCheckBoxChecked(sender, args) { var isChecked = false; $("input[type=checkbox][checked]").each( function() { //Check if checkbox is checked if($(this).is(':checked')) { isChecked = true; } } );
args.IsValid = isChecked; return; } </script>
If you have specific checkboxes that you don't want to validate, then you can add a bit more jQuery to the script to check for specific items. Below I am doing a check on any checkbox that does not have the class 'NonMandatory' assigned to it (note:// I am using the parent check for the class as with ASP.NET the CSSClass of a checkbox is assigned to the span class that surrounds the checkbox control).
<script type="text/javascript"> function CheckAnyCheckBoxChecked(sender, args) { var isChecked = false; $("input[type=checkbox][checked]").each( function() { //Don't check for non mandatory check boxes if($(this).parent().hasClass('NonMandatory') == false) { //Check if checkbox is checked if($(this).is(':checked')) { isChecked = true; } } } );
args.IsValid = isChecked; return; } </script>
April 23 Invalid Security Validation in SharePoint codeTwice in the past week I have had the issue in my MOSS code where it is throwing an exception:
As it turns out the problem isn't so had to fix. Basically you need to set FormDigestSettings to disabled. This can be done in your code as follows: SPWebApplication webApp = site.WebApplication; This can also be fixed by turning off the security validation for an application in Central Admin (however I probably wouldn't recommend this): Central Admin -> Application Management -> General Settings -> Turn security validation off January 22 Launching an application from a link in SharePointWhen you are viewing lists of items in SharePoint, the context menu is fantastic as it allows you to edit documents directly from certain native applications. For example with a Word document you are able to select 'Edit In Microsoft Word' from the context menu, which when clicked fires up Microsoft Word and enables you to edit the document. However when you start creating your own custom webparts from SharePoint list items, you lose this ability. Today I had the challenge of providing a link to a document that was stored in a SharePoint list, but I needed to be able to fire the document up directly from the link.
After quite a bit of trawling through the web I found this great article which really got me going in the right direction:
http://wiki.threewill.com/display/is/2007/10/. Basically you need to call a javascript method called dispex() which will open the application for you (instead of opening the document as read only). So within my code I already had my Hyperlink control (lnkDocumentDownload) which was populated by an SPListItem. This also has the URL of the document set in lnkDocumentDownload.NavigateUrl. This needs to be set for this to work, and of course for applications that don't have integration with SharePoint, they will just use this link to go to the document. What I needed to additionally add to enable the launching of the application was:
lnkDocumentDownload.Attributes.Add( Once I added this in, whenever I clicked the link in my control, it would behave in the same way as clicking on 'Edit in Microsoft Word'. I also found some 'kind of' (not really) helpful documentation on the javascript methods on the Microsoft website here: http://msdn.microsoft.com/en-us/library/cc264013.aspx January 21 Presentation on SharePoint Search and LongitudeYesterday I did a presentation for the Perth SharePoint User group on MOSS 2007 search and enhancing it with Longitude (a product by BA Insight).
For details about the presentation check out the UserGroup site here.
If you are interested in downloading the presentation (which includes notes in the slides), then you can use one of the links below:
|
|
||||
|
|