Tuesday, December 4, 2007

Microsoft Visual Source Safe Client - C#

Microsoft Visual Source Safe Client C#

In .Net there is a class VSSDatabaseClass

try
{
    vssDB =
new VSSDatabaseClass();
    vssDB.Open(
this.txtDatabase.Text, txtUserName.Text, txtPassword.Text);
}
catch(System.Runtime.InteropServices.COMException comex)
{
    vssDB=null;
   
if (comex.ErrorCode == -2147166526 || comex.ErrorCode == -2147352566)
    {
        MessageBox.Show(
"User Name or Password is incorrect.",
                       
"Login Failed",MessageBoxButtons.OK,
                        MessageBoxIcon.Error);
    }
   
else
    {
        MessageBox.Show(
"Unknown VSS COM Exception:\n\n" + comex.ToString(),
                       
"Login Failed",MessageBoxButtons.OK,MessageBoxIcon.Error);
    }
}

Using this class we can write a client for Source Safe

 

No comments: