Hope that helps.
JBK.Net
Promoting application development with the Microsoft .Net platform.
Monday, November 16, 2020
SQLPlus.NET - the effort-less Microsoft.NET ORM for SQL Server
Hope that helps.
Tuesday, October 20, 2020
I'm Back!
Saturday, March 17, 2012
VMWare Guest OS Won’t Connect to Internet–How I fixed it
I use VMWare Workstation to host virtual machines (VM) for writing my articles. I make sure to use a VM that has only the software that I really need, to eliminate side effects that could skew the behavior of the software I am writing about.
Some time ago, I started having the problem that I could not get the Windows 7 Professional guest OS to connect to the internet inside the VM. Nothing worked. I tried NAT, bridged, bridged with copied physical adapter settings. I reset the Windows Firewall, I turned off the Windows firewall, I ran network diagnostics.
I searched the Internet for a solution but found nothing particularly helpful. I was spending precious time I should have been writing, on frustratingly unsuccessful attempts to solve this problem. I am running VMWare Workstation version 7.1.5 build-491717.
I worked around it by downloading files on the host laptop and putting them in a shared folder that the VM could see. For applications that required Internet access, I worked on the bare metal of my laptop but I really wanted the isolation of the VM.
Today I realized the bridged connection was bridging to my unconnected ethernet port and not my wireless adapter. There is no way to specify what to bridge to in the VM settings but I found the Virtual Network Editor utility in the VMWare application folder on the host laptop. It has an option to specify which device the Bridge will connect to. I set it to bridge to my wireless adapter and now I have Internet access in all my VMWare VMs without any issue.
I post this for others that may be experiencing the same issue. If you found this post helpful, please add a comment to that effect.
Joe Kunk
Microsoft MVP VB
Okemos, MI USA
Tuesday, October 11, 2011
A CLR Alternative to the SQL Server ISNUMERIC function
My article on a better CLR alternative to the SQL Server IsNumeric() function just published in Visual Studio Magazine. http://visualstudiomagazine.com/articles/2011/10/11/a-clr-alternative-to-isnumeric.aspx
I hope you find it useful.
Joe Kunk
Microsoft MVP Visual Basic
Okemos, MI USA
October 2011
Thursday, February 24, 2011
Programmatically Changing the XAML of a WPF Control
Despite many years as a Windows Forms developer, I am a beginner at writing software in Windows Presentation Foundation (WPF). Most project requests I receive are for thin client web-based solutions. I have not had a request for a desktop application that really required the advanced visual interactivity of WPF. That combined with the limited ability to use the Windows Forms controls that I know so well has kept me out of WPF.
I am now prototyping my first WPF application and feeling appropriately lost as I try to do things that I know that WPF can do but I have no inkling of how to accomplish. I actually enjoy learning new technologies so I am not complaining, but I am. You know what I mean.
I have a StackPanel as the content of a tab control panel at the right side of my main page. That StackPanel will host of contents of the appropriate UserControl StackPanel based on which option is selected on the main page. This allows the tab panel to change dynamically based on which left side-panel label is clicked.
The code-behind that worked to do this is below. Before I get flamed, I realize that in a production application I would be using the MVVM or MVP pattern and I would not do it this way. But this is just a quick demo and I just want to illustrate the effect.
Project_Approval_Data is the name of the UserControl that has the content to appear in the tab control panel when the “Project Approval” TextBlock is clicked. spContent is the name of the StackPanel has has the desired content; it is the same name in all the UserControls.
I am using Visual Studio 2010 Premium and .Net 4.0 Client Profile framework. I appreciate any comments showing a better way.
Yes, this particular project is being done in C# at the customer’s request.
Project_Approval_Data project_Approval_Data =
new Project_Approval_Data();
string spXAML =
XamlWriter.Save(project_Approval_Data.spContent);
StackPanel spSource = (StackPanel)XamlReader.Parse(spXAML);
tabItem_DataTab.Content = spSource;
Hope that helps.
Joe Kunk
Microsoft MVP Visual Basic
Okemos MI USA
February 24, 2011
Wednesday, May 19, 2010
First “On VB” column published in Visual Studio Magazine
My first “On VB” column was published on the website of Visual Studio Magazine. It is titled “Calling Win32 API Functions in Visual Basic 2010” and is available at http://visualstudiomagazine.com/articles/2010/04/20/call-win32-api-functions-in-vb.aspx.
This article discusses the value of reaching beyond standard managed code and taking advantage of the functionality available in the native Win32 API, including some functionality not currently available via managed code.
Hope you find it informative and useful.
Joe Kunk
Microsoft MVP VB
Okemos, MI USA
May 19, 2010
Saturday, March 20, 2010
SQL Server Trigger to Log Who Created or Last Modified a Row and When
I implement this trigger to automatically update the CreatedOn, CreatedBy, ModifiedOn, ModifiedBy fields on almost all tables that I create in SQL Server so I decided it was time to share.
Even if you don’t think you need this trigger, I can assure you that you will be glad you added them at some point in the future. It is just so useful to know who created or modified the rows when data quality issues arise.
This trigger is not a full audit trail, it only retains information on the latest change. A full audit trail would require at least one dedicated audit table and is a much more involved, whereas this is simple to implement.
It assumes a unique primary key on each table and works for both SQL user accounts and integrated security.
This example was taken from a SQL Server 2005 database. I have successfully used the same trigger in SQL Server 2008.
Hope this helps.
Joe Kunk
Microsoft MVP VB
Okemos, MI USA
Create TRIGGER [trgMyTableCreatedModified]
ON dbo.MyTable
AFTER INSERT,UPDATE
AS
BEGIN
SET NOCOUNT ON;
Declare @now datetime
Declare @user varchar(50)
SELECT
@now = GetDate()
,@user = user_name()
UPDATE T SET
CreatedOn = COALESCE(I.CreatedOn, @now)
,CreatedBy = COALESCE(I.CreatedBy,@user)
,ModifiedOn = @now
,ModifiedBy = @user
FROM inserted I
JOIN dbo.MyTable as T
ON T.MyTableKey = I.MyTableKey
END