Software Development
Deleting all data from an MS Access database
If you need to empty/truncate all user data from an MS Access database, the following VB script should do the job:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
Public Sub TruncateTables() On Error GoTo Error_TruncateTables Dim DB As DAO.Database Dim TDF As DAO.TableDef Dim strSQL_DELETE As String Set DB = CurrentDb() For Each TDF In DB.TableDefs If Left(TDF.Name, 4) <> "MSys" Then If Left(TDF.Name, 1) <> "~" Then strSQL_DELETE = "DELETE FROM " & TDF.Name & ";" DB.Execute strSQL_DELETE End If End If Next MsgBox "Tables have been truncated", vbInformation, "TABLES TRUNCATED" DB.Close Exit_Error_TruncateTables: Set TDF = Nothing Set DB = Nothing Exit Sub Error_TruncateTables: Select Case Err.Number Case 3376 Resume Next 'Ignore error if table not found Case 3270 'Property Not Found Resume Next Case Else MsgBox Err.Number & ": " & Err.Description Resume Exit_Error_TruncateTables End Select End Sub |
Happy coding… Tweet
Accessing local data files using Html and Chrome
During the development and testing stages of a new website, there are time when you may need to access Json or xml data stored in a local file. The test site can be running under Visual Studio, IIS Express or even IIS. I recently had to quickly test some javascript code that interacted with Json [...]
Fixing virtual disk errors in VMware
As a developer, I tend to use VMs extensively to test new features and deploy software that I wouldn’t like running on my main machine. VMware is brilliant in that it offers a free tool to create and run VMs – VMware Player. As handy and great VMs are, they are also quite volatile and [...]
Deleting a project from Hosted TFS
I added a project to the wrong TFS collection! Now what? Removed all the bindings from my solution but the TFS service now points to an orphaned entry. Unfortunately, up to this day, the TFS team have not been kind enough to supply us with a GUI tool that can delete a project from the [...]
XML Validation Failure Due To Invincible White Space
After spending 3 hours of my life trying to resolve the following error message: The element cannot contain white space. Content model is empty I decided to share my solution in hope that this will help somebody else. The xml file that was failing validation is:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
<?xml version="1.0" encoding="utf-8"?> <ComponentSet Default="Create Data Set"> <Procedures> <Procedure Name="Create Data Set"> <MainFlow> <CreateDataSetVersion Name="run create data set version task" Description="this the description" CollectionId="collection" DataProviderId="dataprovider" DataSetDescription="datasetDescription" DataSetName="datasetName" DataSetSchemaCode="schemaCode" DataSetVersionCode="datasetCode"> </CreateDataSetVersion> </MainFlow> </Procedure> </Procedures> </ComponentSet> |
And the xsd part responsible for the validation [...]
Tidy up your forms with horizontal sliding divs using JQuery UI
Many websites still make use of lengthy scrollable forms or numerous page post backs when requesting input from their users, e.g shopping cart check outs etc. jQuery and jQueryUI give developers the opportunity to significantly improve the overall UI experience. In this tutorial, we will look into creating sliding panels/divs that respond to user input [...]
Uncaught TypeError: Object [object Object] has no method ” – jQuery Error
Many developers have been caught up by this error message judging by the number of posts on StackOveflow! I had to fight with this exception for a few hours until the solution popped out to remind me that losing focus is never a good thing! After having a working prototype, I tried to integrate the [...]
Checking if a generic collection is empty with Linq and C#
This is a common issue for many developers. How do you quickly and efficiently determine whether a given non-null collection contains any valid non-empty elements . The string class is cool because you can use the string.IsNullOrEmpty(yourstring); to test for null and/or empty. Unfortunately, generic collections don’t implement a similar method. There are two ways [...]
HTML5 Drag and Drop file upload with preview using jQuery and MVC 4
With the advent of HTML5 and its wide adoption by all major browsers, web developers now have a new arsenal in their hands for implementing powerful file upload functionality on their website. In this tutorial we will see how to implement this using the FileDrop jQuery plugin and an MVC controller to receive and store [...]
NLog with SQL Server and MVC 4
NLog is an awesome open-source logging tool that allows developers to easily and efficiently implement custom logging. Nlog can be configured to log to a number of targets, but on this tutorial we will be looking at logging to the database. First you need to add NLog to your MVC website. Bring up the Nuget package [...]



