- Here is a link to SQL Server Data Type Mappings documentation that I found helpful in understanding how SQL data types map to .NET data types and what SQL DataReader typed accessor (e.g., GetString and GeBoolean) is needed to read a particular SQL data type from within .NET.
- A good link on how the retrieve the Microsoft SQL rowversion/timestamp value from the standard IDataReader interface. Below is how I implemented.
byte[] rowVersionBuffer = new byte[8];
dataReader.GetBytes(rowVersionField_OrdinalValue, 0, rowVersionBuffer, 8); // rowversion storage size is 8 bytes. timestamp is a synonym for rowversion.
businessObject.RowVersion = rowVersionBuffer;
// business object rowversion/timestamp property
private byte[] _RowVersion
public byte[] RowVersion
{
get { return _RowVersion;}
set { _RowVersion = value; }
}
- jsfiddle A tool to test HTML, CSS, and JavaScript.
5e19a19c-bd2e-4ae7-a576-f18a89e52ff4|0|.0
I was working on a Visual Studio 2010 VB.Net Windows Service application. I added a reference to an in-house IO library and then used the Imports keyword to import the namespace from the referenced assembly. IntelliSense recognized the namespace and I had access to the methods in the IO library.
I then tried to compile the application. It failed. My Imports statement for the IO library and the methods I used with that library generated error messages. Along with the errors, I noticed a warning message. The warning message provided the clue to the solution. It mentioned that the referenced IO assembly could not be resolved because it had a dependency on System.Data.OracleClient.
Here is the link where I found the solution (thanks Xiaoyu!). It turns out that when I added the new Windows Service project, the targeted framework was for the .NET Framework 4 Client Profile. That framework does not include the System.Data.OracleClient.dll.
The fix: Change the target framework to .NET Framework 4 (Project Properties -> Compile tab -> Advanced Compile Options… -> Target framework drop down).
f21289cc-c1f1-4b1d-8edf-fea745ac3717|0|.0
- How to remove a .Net project/solution from Team Foundation Server (TFS) source code control? From within Visual Studio 2010, File->Source Control->Change Source Control..., and then unbind the project/solution. Here is the link where I found this information.
aff008db-335d-473f-9418-755b6dc3922b|0|.0
- Here is another way to clear browser cache with Internet Explorer: F12, Ctrl+R
- I wanted to include the build date in an "about" form for a Windows desktop application. Below is code to get the build date of the application.
' Get Build Date information.
Dim _ExecutingAssemblyName As String = Assembly.GetExecutingAssembly.GetName().Name
Dim _ExecutingAssembly As Assembly = Assembly.GetExecutingAssembly
Try
Dim _buildDate As Date = File.GetLastWriteTime(_ExecutingAssembly.Location)
lblBuildDate.Text = lblBuildDate.Text + " " + _ExecutingAssemblyName + ", " + _buildDate.ToString
Catch
lblBuildDate.Text = " Error trying to find Build Date."
EndTry
- Here is a link to a free interactive .NET tutorial from Motti Shaked.
2eb32592-2b0e-4f50-ba1e-6e6cfc875c88|0|.0
-
Here is a link to David Padbury’s blog on using Isotope
with Knockout.js.
Check it out!
-
This issue has been covered before in other blog posts,
but I want to reiterate what you can do when you get the following error
message when working with Microsoft SQL Server: The database could not be exclusively
locked to perform the operation. (I
received this message when I tried to change the name of a database.)
A fix for this problem is to set the restrict access property of
the database to a SINGLE_USER. Next,
make your change (In my case I changed the name of the database). Followed by, setting the restrict access property back
to MULTI_USER .
You can set the restrict access property through either T-SQL
code or from SQL Server Management Studio.
T-SQL Code:
ALTER DATABASE [database_name] SET SINGLE_USER WITH
ROLLBACK IMMEDIATE
ALTER DATABASE [database_name] SET MULTI_USER
SQL Management Studio:
Right mouse click on the database and select
properties. Under Select a page, click
on Options. Scroll down to the State Group
and find the Restrict Access property and change its setting accordingly.
Here is the link where I found this fix.
-
A link to Orchard CMS. Orchard CMS is a free, open source content management system that allows users
to rapidly create web sites on the Microsoft ASP.NET platform. It is built on a
flexible extensibility framework that enables developers and customizers to
provide additional functionality through extensions and themes.
eabb0a9d-8674-4e6a-8fc9-0a116406d42e|0|.0
-
I had a request to have a company logo that was incorporated into a larger image contain a link to a new company website. The solution: Create an HTML image map and refer to that image map in the <img> tag. I used Paint.Net to get the coordinates of the logo for the coords attribute of the <area> tag. For more details, follow this link. Thanks Nebojsa Pajkic!
<map name="CompanyLogo">
<area shape="poly" coords="32,92,89,65,147,96,87,122,48,114" href="http://NewCompanyWebSite.com" />
</map>
<img src="images/largeImageWithLogo.jpg" usemap="#CompanyLogo">
-
Here is a
link on how to optimize WPF performance. Here is
link for a performance profiling tool for WPF from MSDN.
9a915ac1-dbd9-40a5-91e8-698c41a87268|0|.0
We had in place a daily process where we imported item information from SAP into an Items table in a SQL 2005 database. The SAP information was placed in a .txt file and then bulk inserted into the table using the T-SQL Bulk Insert command.
We were then asked to modify this process. Instead of completely overwriting the Items table in the database, we needed to merge the SAP item information into the Items table. That is, we needed to update and insert rows in the Items table using the SAP .txt file as input.
If the database was an SQL 2008 database, we would have used the Merge command to merge the information; however, we were using SQL 2005. Below are the steps and T-SQL I created to simulate the Merge command.
1) Created a replica of the Items table called Load_Items
2) Ran the following T-SQL
-- Load SAP Item information into Load_Items table with Bulk Insert command.
Truncate table Load_Items
BULK INSERT Load_Items
FROM '\\servername\SAP_Items.txt'
WITH (FORMATFILE = ‘\\servername\SAP_Items.FMT')
/*
Merge updated and new Item information into Items table by deleting rows in the Items table that have the same key value (Item_Code) as that
in the Load_Items table and then insert those rows back (update) plus any new rows (insert) from the Load_Items table.
*/
Delete from Items
Where Item_Code In (Select Item_Code from Load_Items)
Insert Into Items
Select * from Load_Items
c22e464c-d01c-4378-bc93-9a4c493392f6|0|.0
I was querying an Order Header table and was coming up with confusing results (the result set had too many rows). The table used an Identity column as the primary key. The table also contained an order confirmation number column that should have been unique. To make a long story short, the reason I was getting confusing results was because there were rows in the Order Header table that contained the same order confirmation number. This happened when I imported a more recent version of the Order Header table from another database, but neglected to also import a more recent version of the table that controlled the generation of order confirmation numbers. When I then created new orders, the new Order Header rows were created using older confirmation numbers, and as a consequence, duplicate order confirmation numbers were entered into the table. This scenario would NOT have occurred if the order confirmation number was the primary key. An error would have occurred when I tried to add a new order that had a confirmation number that already existed in the Order Header table.
Here are some links to choosing a primary key that I found interesting.
http://databases.aspfaq.com/database/what-should-i-choose-for-my-primary-key.html
http://weblogs.sqlteam.com/jeffs/archive/2007/08/23/composite_primary_keys.aspx
http://decipherinfosys.wordpress.com/2007/02/01/surrogate-keys-vs-natural-keys-for-primary-key/
http://www.mssqltips.com/tip.asp?tip=1600
6a163e6b-dc86-4b98-8875-609bf916e831|2|1.0
-
I made some changes to .html files on a production web site, yet when I went to my computer, the changes did not take effect (using IE 7). I then cleared cache (Tools -> Internet Options -> Browsing History -> Delete). Clearing cache did not work either. The changes did not show up. I then reloaded the start page by bypassing cache. To bypass cache, hold the Cntrl key and press F5 or hold the Cntrl key and press the Refresh button in the toolbar. Bypassing cache solved the problem. My changes showed up.
-
To avoid the security warning you get after copying your Microsoft Access 2007 program to a new directory, copy your Access program to the C:\Program Files\Microsoft Office\Office12\ACCWIZ folder.
-
Microsoft SQL Server 2008 R2 Report Builder 3.0 provides an intuitive report authoring environment for business and power users. It supports the full capabilities of SQL Server 2008 R2 Reporting Services. The
download provides a stand-alone installer for Report Builder 3.0.
-
Fiddler (Fiddler is a Web Debugging Proxy which logs all HTTP(S) traffic between your computer and the Internet) is in IE 9. In IE 9, press the F12 button to bring up the Devloper Tools window.
a038f540-5e8b-43f4-ab8a-3bdee57484c4|0|.0
- From Andy Warren, use Scope_Identity() function instead of @@Identity when retrieving identity for most recently added row to a table.
Scope_Identity is the best way to get the identity value of a just inserted row. It's a drop in replacement for @@Identity and a good way to make sure that you don't have problems in the future if someone adds a trigger that inserts into another table with an identity column. Also, some more information on the subject from David Hayden.
- I had linked an SQL table in Microsoft Access 2007. I could not make any edits to the table in Access. The fix? The SQL table did not have a primary key defined. Once I defined a primary key for the table in SQL, and then in Access updated the table in the Linked Table Manager (right mouse click on table in table objects), I was able to make edits to the table in Access. I found the solution here.
82dca6f9-8e13-419d-94d5-c555902c8ab1|0|.0