Getting rid of that blank column on the left side of a WPF DataGrid

In WPF, when working with the DataGrid, by default it will put a blank column on the left side of a DataGrid. This, I believe, is for selecting the row. However, it isn’t always nice looking and sometimes your users complain.

I’ve looked around for ways of getting rid of that empty column on the left side of the DataGrid. A solution which I find works, is putting in the attribute of RowHeaderWidth=”0″ in the DataGrid’s tag. Like this:

<DataGrid x:Name="DateTimeDataGrid" 
          BorderBrush="DarkGray"
          ItemsSource="{Binding Times}"
          SelectedItem="{Binding SelectedClassDate}"
          BorderThickness="1"
          AutoGenerateColumns="False"
          CanUserAddRows="True"
          CanUserReorderColumns="False"
          RowHeaderWidth="0"
          CanUserDeleteRows="True"
          Height="125">

Here’s a post I found on Stack Overflow about this.

Posted in Uncategorized | Tagged , | Leave a comment

A Good post on SQL Injection

Today I came across a good post on SQL Injection.

Posted in SQL | Leave a comment

Importing Data from a .CSV to SQL Server 2016

I had to import almost 130K records from a table in an Access 2016 database (.ACCDB) into a SQL Server 2016 database. Due to several restrictions on other ways of solving this problem I finally decided upon exporting the data out of the .ACCDB into a CSV text file. From there I tried to use SQL Server Management Studio (SSMS) 17.8.1’s Import Flat File wizard. I ran into two problems, which I thought I’d share.

The original table has almost 200 columns in it, which I wanted to duplicate in SQL. Many of those columns were Boolean data types. (Access calls them Yes/No fields. SQL Server calls them Bit fields.) And several other columns were date/time data types.

When I chose what data type to translate the Yes/No fields into SQL, I decided to use the bit data type. Well, SSMS’s Import Flat File didn’t like that at all! So, for now, what I’ve done is used the SQL Server data type of Int. Later I can change the data types for those fields using an ALTER TABLE … ALTER COLUMN command.

The other problem was the date/time fields from the CSV file. I thought that using SQL’s datetime data type would have worked, but it didn’t. Instead I got this error:

SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM. (System.Data)

Very irritating. So I chose the datetime2 SQL data type instead. SSMS’s Import Flat File wizard was happy with that.

Posted in Computers and Internet, SQL Server | Leave a comment

How to schedule and automate backups of SQL Server databases in SQL Server Express

This is a handy knowledge base article.

How to schedule and automate backups of SQL Server databases in SQL Server Express

Posted in Computers and Internet | Leave a comment

Signing PowerShell Scripts – Scott Hanselman

If you work with PowerShell scripts, this is handy.

Signing PowerShell Scripts – Scott Hanselman

Posted in Computers and Internet | Leave a comment

How to Select Null/None in a ComboBox/ListBox/ListView

Phil On .NET

When using a Selector control like ComboBox, ListBox, or ListView to present a non-required/optional field, you might want a special item like “(None)” to appear in the list, representing null/DBNull. This is a fairly common scenario, particularly with nullable foreign keys, but how to accommodate this requirement in the view may not be straightforward when you’re data-binding the ItemsSource, which is typically the case.

Although you could add a special object representing null (which we’ll call the “None” item) to the source collection itself, for practical and philosophical reasons you probably don’t want to modify the collection just to accommodate a particular presentation of it. Of course, if your collection consists of individual data wrappers or view models, adding the None object to the collection may not be an issue. Regardless, we’ll proceed with the assumption that you don’t want to modify the source collection.

A nice way to include…

View original post 181 more words

Posted in Uncategorized | Leave a comment

awsomedevsigner: Expression Blend Changes – Visual Studio 2012 Update 2 RTM

I’ve been wondering when Blend was coming for Visual Studio.

awsomedevsigner: Expression Blend Changes – Visual Studio 2012 Update 2 RTM

Posted in Uncategorized | Leave a comment

Temporary Tables – SQLTeam.com

Handy article on how to use CREATE TABLE, INSERT and SELECT in SQL to populate a temporary table.

Temporary Tables – SQLTeam.com

Posted in Computers and Internet | Leave a comment

What is Microsoft BI?

Useful description of what Microsoft BI is.  At least around the SQL Server 2008 R2 time frame.

What is Microsoft BI?

Posted in Business, Computers and Internet | Leave a comment

Doctor Who mentioned on The Big Bang Theory

Link here.

Posted in Uncategorized | Leave a comment