Richard

  • Home
All Posts Links About

Richard

  • Home

SQL Server 2008 Feb CTP

2008-03-05

A few features I like in the SQL 2008:

  • Database encryption
  • Database backup compression
  • FileStream support for big files

I also like the IntelliSense in the new SQL Management Studio.

  • SQL Server

Show All >>

Execute SSIS Package in C# Apps

2008-03-04

Add referrence to Micosoft.SQLServer.ManagedDTS.dll. It is in your SQL Server Program Files Folder\SDK\Assemblies.

using Microsoft.SqlServer.Dts.Runtime;

namespace ExecuteSSIS
{
class Program
{
static void Main(string[] args)
{
Application app = new Application();
//
// Load package from file system
//
Package package = app.LoadPackage(@”c:\myPackage.dtsx”, null);
package.ImportConfigurationFile(@”c:\myPackage.dtsConfig”);
//Pass parameters
Variables vars = package.Variables;
vars[“variable”].Value = “values”;
DTSExecResult result = package.Execute();
Console.WriteLine(“Package Execution results: {0}”,result.ToString());

//
// Load package from Sql Server
//
Package package2 = app.LoadFromSqlServer(
“myPackage”,”server_name”, “sa”, “password”, null);
package2.ImportConfigurationFile(@”c:\myPackage.dtsConfig”);
//Pass parameters
Variables vars2 = package2.Variables;
vars2[“variable”].Value = “value”;
DTSExecResult result2 = package2.Execute();
Console.WriteLine(“Package Execution results: {0}”,
result2.ToString());
}
}
}

  • SQL Server
  • SSIS

Show All >>

Use Active Directory to Authenticate

2008-02-16

Today I spent sometime to review the System.DirectoryServices name space in .Net 2.0. It is very convenient to use it to access A.D. and doing Authentication for your apps. Here are some sample codes in C# you might need to start with:

//Variables for getting groups
string _path;
string _filterAttr;

bool validateUser(string username, string password)
{
//Validate Users
string path = “LDAP:// your domain”;
string domainUserName = domain + @”\” + username;
DirectoryEntry entry = new DirectoryEntry(path, domainUserName, password);

  try  
 {  
          // Bind to the native object to force authentication to happen  
         Object obj = entry.NativeObject;  
         DirectorySearcher search = new DirectorySearcher(entry);  
         search.Filter = "(SAMAccountName=" + username + ")";  
         search.PropertiesToLoad.Add("cn");  
         SearchResult result = search.FindOne();  
         if (result != null)  
         {  
                // Authenticated  
              _path = result.Path;  
              _filterAttr = result.Properties["cn"][0].ToString();  
                return true;  
          }  
          else  
                return false;  
}  
catch (Exception ex)  
{  
         throw new Exception("User not authenticated: " + ex.Message);  
}  

}

//Getting the groups this user belongs to
string getUserGroups()
{
DirectorySearcher search = new DirectorySearcher(_path);
search.Filter = “(cn=” + _filterAttr + “)”;
search.PropertiesToLoad.Add(“memberOf”);
StringBuilder groups = new StringBuilder();

try  
{  
    SearchResult result = search.FindOne();  

    int nCnt = result.Properties["memberOf"].Count;  

    for (int i = 0; i                {  
        string dn = result.Properties["memberOf"][i].ToString();  
        int eidx = dn.IndexOf("=", 1);  
        int cidx = dn.IndexOf(",", 1);  

        if (eidx == -1)  
        {  
            return string.Empty;  
        }  

        groups.Append(dn.Substring(eidx + 1, cidx - eidx - 1));  
        groups.Append("|");  
    }  
}  
catch(Exception ex)  
{  
    throw new Exception("Groups not getting: " + ex.Message);  
}  
return groups.ToString();  

}

  • .Net Framework 2.0
  • Active Directory
  • Authentication
  • C#

Show All >>

Referenced assembly System.Deployment is not installed for ClickOnce?

2008-02-13

My computer has been complaining for “Referenced assembly System.Deployment is not installed…” whenever trying to install any ClickOnce apps. And those apps were not installed successfully since sometime. Here are the solutions I found from msdn forum. It worked very well after I delete the ClickOnce store folder.

  1. Run “Mage -cc”. (Mage.exe can be found in the .NET 2.0 SDK)

  2. Uninstall the application via Add/Remove Programs and reinstall it

  3. If neither of these work then the last option is to delete the ClickOnce store and get back to clean state. To delete the ClickOnce store delete the folder “%userprofile%\Local Settings\Apps”.

  • .Net Framework 2.0
  • Clickonce

Show All >>

Use Authorization Manager (AzMan) with ASP.NET 2.0

2008-02-11

It is very convenient to use AuthorizationStoreRoleProvider with ActiveDirectoryMembershipProvider for ASP.net application authentication and security control. But there are a few tricks you need to know when developing and deploying. Here are the useful links:

How To: Use Authorization Manager (AzMan) with ASP.NET 2.0

When I tried to deploy the app to Windows 2003 Service Pack 1, it didn’t work. I found out it needs to apply this fix (KB915786) to make it work.

  • ASP.net
  • AzMan
  • Windows 2003

Show All >>

LINQ Pad

2008-02-09

Want to try LINQ. This is a cool start for LINQ. Have fun.

LINQ Pad

  • LINQ

Show All >>

SoCal MSDN Event

2007-12-05

Went to MSDN Event yesterday. Lynn‘s talk and presentation was quite useful. Here are some of the new stuffs I got.

Microsft Popfly (www.popfly.com) is a new Web Platform still in Beta. But looks very interesting. I just signed in and played around a little bit. The design and architecture is very good. I will use it definitely.

Astoria (astoria.mslivelabs.com) is also a very interesting project. It is kind of advanced Web Data Access framework and foundation.

And I got a book “Introduction to Silverlight 1.0”, too. Although it will be outdated soon since 2.0 is on the way.

  • MSDN

Show All >>

How to examine SQL Server's I/O Statistics

2007-11-07

I just happened to find this old article. But it is still good.

http://www.databasejournal.com/features/mssql/article.php/10894_2244381_1

  • I/O
  • SQL Server

Show All >>

Visual Studio 2008 trial

2007-10-18

I have been tested the Studio 2008 Beta 2 for two months already. So far, it is pretty stable. And I already used it to maintain some of our websites. It is faster than Studio 2005. Let’s wait for the final release soon.

  • Visual Studio 2005
  • Visual Studio 2008

Show All >>

Create Data Dictionary for SQL Server Database

2007-09-11

Recently, I need to create a data dictionary for our 12GB database. And I did a research on creating data dictionary, and found this good tool - Data Dictionary Creator. It stores all the information in Extended Properties. Here are some blog link for this cool tool:

Data Dictionary Creator - Rapid database documentation

Generate Sql Server data dictionary table

  • Data Dictionary
  • Database
  • SQL Server

Show All >>

« Prev1…1011121314…16Next »
© 2017 Richard
Hexo Theme Yilia by Litten
  • All Posts
  • Links
  • About

tag:

  • ASPNET
  • DotNetCore
  • VS2015
  • Service Pack 2
  • SQL Server
  • Database Restore
  • SQL Server 2008 R2
  • GitHub
  • Blog
  • Trace Flags
  • SQL Server 2017
  • Linux
  • SQL Server Management Studio
  • SSMS
  • SQL Server 2014

    缺失模块。
    1、请确保node版本大于6.2
    2、在博客根目录(注意不是yilia根目录)执行以下命令:
    npm i hexo-generator-json-content --save

    3、在根目录_config.yml里添加配置:

      jsonContent:
        meta: false
        pages: false
        posts:
          title: true
          date: true
          path: true
          text: false
          raw: false
          content: false
          slug: false
          updated: false
          comments: false
          link: false
          permalink: false
          excerpt: false
          categories: false
          tags: true
    

  • SQL Server Updates
  • SQLBlog.com
  • SQL Server Central
  • My Old Blog Site 1
  • My Old Blog Site 2
  • Unicode Character Map for Windows
  • Dev Tool List (From Scott Hanselman)
Improve daily life using IT techs.