Showing posts from September, 2018

VS2017.15.8.4 Error fixed

Recently, I am a bit of fear to upgrade VS2017. Especially a major version was changed that every time will occur some error after installed. This time I  upgrade it from 15.7.x to 15.8.4.As expected all of my projects cannot be loaded. Workaground According to the message I head to the developer forum where I found the answer as below: 1. Run as administrator to open Developer Command. 2.Enter the following commands. gacutil /i "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Build.Framework.dll" gacutil /i "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Build.dll" gacutil /i "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Build.Engine.dll" gacutil /i "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Build.Conversion.Core.dll" gacutil /i "C:\Pro

SQL Server pass parameter to Procedure

Today, My colleague mention his work which how to pass the parameter to the procedure. The workaround as below: 1.Declare a custom table type CREATE   TYPE   dbo . USER_TABLE_TYPE  AS   TABLE   (        USER_NO   VARCHAR ( 8 ) ) 2.C# Declare DataTable and SqlParameter      var   table =   new   DataTable();             table.Columns.Add( new   DataColumn( "USER_NO" , System.Type.GetType( "System.String" )));             table.Rows.Add(table.NewRow());             table.Rows[0][ "USER_NO" ] =   "Abc" ;               var   par =   new   SqlParameter             {                 ParameterName =   "userTable" ,                 Value = table,                 SqlDbType = SqlDbType.Structured,                 TypeName =   "dbo.USER_TABLE_TYPE"             }; 3.Declare parameter which type is just created CREATE   PROCEDURE   dbo . GetUsers        @userTable USER_TABLE_TYPE  READONLY