Hi
I hav created a com library by which i can discover the SQLVolumes using SMo namespace in VS2005. Now i want to use this com library in VS2003 to discover the same sqlvolumes in another machine where vs2003 installed.
Can i use like this. I hav created a COM using version VS2005 and now i want to consume it in VS2003 is it possible??
i rquest u pepole not to make it as duplicate bcoz i need effective answer.
@
using System;
using System.Data.SqlClient;
using Microsoft.Win32;
using Microsoft.SqlServer.Management.Smo;
using Microsoft.SqlServer.Management.Common;
using System.Data;
public interface ICalculator
{
void Show();
};
namespace ManagedDLL
{
public class ManagedClass : ICalculator
{
public void Show()
{
Console.WriteLine("from managed class");
Console.WriteLine("c# "); Console.WriteLine("c#");
DataTable dt = new DataTable();
string srvname,filepath;
//evaluates local instances of SQLSERVER
dt = SmoApplication.EnumAvailableSqlServers(true);
Console.WriteLine("Local Instances are \n");
foreach (DataRow dr in dt.Rows)
Console.WriteLine(dr["Name"]);
foreach (DataRow dr in dt.Rows)
{
srvname = (string)dr["name"];
Console.WriteLine("\nConnecting to Server " + srvname + "\n\nDiscovering Volumes...\n\nDiscovering Sql2005 Volumes for the Host " + srvname.ToLower() + "\n");
Console.WriteLine("\nHostName : " + srvname.ToLower() + "\n");
Server srv = new Server(srvname);
Console.WriteLine(" Server Name \n" + srv.Name);
foreach( Database db in srv.Databases)
{
filepath = db.PrimaryFilePath;
Console.WriteLine("File Path : " + filepath + "\\" + db.Name + ".mdf \n");
Console.WriteLine("File Path : " + filepath + "\\" + db.Name + ".ldf \n");
}
}//foreach
}
}
}
i hav created a com library for this class.
and i have to use this com library in vs2003. and one nore thing is the smo namespace
above doesnot support by .net f/w 1.1 how to can i do like this.
While consuming i am getting the error that
Unhandled exception at 0x7c812a6b in Comssss.exe: Microsoft C++ exception: _com_error @ 0x0012fcbc.