.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Getting "wrong" data out of a microsoft.sqlserver.management.smo.database object property (using pow

Posted By:      Posted Date: August 29, 2010    Points: 0   Category :Sql Server
My problem:I do something like this:$dbsvr = new-object microsoft.sqlserver.management.smo.server "servername"$dbsvr.databases | ft name,size -autosizeWhen i run this from two different PC's i get database sizes that are all the same (5.25 mb), the size of the first database listed - which is master.I started to try out a few things, and found out that when i run the same command from one of our servers it returns the correct sizes...Anyone have any idea if this a SMO issue, or maybe some package software version issue...- or what?

View Complete Post

More Related Resource Links

The current build operation (build key Build Key[Microsoft.Practices.EnterpriseLibrary.Data.Database


Hello everybody,


i am encountering an exception in my in my application at these lines of code.


DatabaseProviderFactory dbFactory =

new DatabaseProviderFactory(dataSource);// Create and return a database object.


return dbFactory.Create(name);


i am getting this exception at the create line


The current build operation (build key Build Key[Microsoft.Practices.EnterpriseLibrary.Data.Database, 125ba2c1-9573-45be-b8a2-b370deff980d]) failed: Exception has been thrown by the target of an invocation. (Strategy type ConfiguredObjectStrategy, index 2)


I have referenced the proper assemblies in my project and on  other systems, its working fine.

The connection string is DB2.My db2 connection is also good with no issues. My stack Trace

What happened to the backup and restore classes in namespace Microsoft.SqlServer.Management.Smo vers

I do not see these two classes in version 10 of this namespace and I am not finding any documentation explaining what happened to them.

Powershell script that uses Microsoft.SqlServer.Management.Smo.Server need to use Sql Server Autheni

I have written a powershell script that uses Microsoft.SqlServer.Management.Smo.Server.  I have a couple of instances that are on different domains that I must use Sql Server authenication.  I am going to create a report user "sssmorpt".  What is the least a can grant this user to allow me to use Microsoft.SqlServer.Management.Smo.Server to get "$dbsize = $db.size - ($db.logfiles|measure-object -property size -sum).sum / 1024" for all databases in an instances?

Problem trying to attach database file to Microsoft SQL Server Management Studio

I was trying to attach a database to SQL Server MGT Studio and got an exception error.  The message stated that the database file I was trying to attach could not be opened because it was version 661.  The SQL Server shows to support version 655 and earlier.  It states that a downgrade path is not supported. Question:  Is there some download ; fix; I can make to SQL Server 2008 that will allow me to attach the version 661????  I am not technical at all.  Please speak slowly.  :)  Thanks

Microsoft SQL Server Management Studio 2008 does not list all tables in database

When logging into SSMS 2008 to a SQL2008 database when I expand the tables in a database I only see a few tables listed.  I can login to the same instance with SSMS 2005 and all of the tables are there.  Is there a reason why this is this way?

I can do a select * from in a query window for any of the tables in the database via SSMS 2008 as well and it work fine.  It just does not display the tables.

The Microsoft Jet database engine could not find the object


try to use code below to access the .xls file, got a error. "The Microsoft Jet database engine could not find the object 'DriverDistanceData'.  
   Make sure the object exists and that you spell its name and the path name correctly" I know the error from line 1. I tried a lot ways in line 1, but didn't work

protected void BtloadData_Click(object sender, EventArgs e)

           string excelConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\DriverDistanceData.xls;Extended Properties=""Excel 8.0;HDR=YES;""";

            using (OleDbConnection connection = new OleDbConnection(excelConnectionString))

                OleDbCommand command = new OleDbCommand("Select * FROM DriverDistanceData", connection);


                // Create DbDataReader t

Microsoft SqlServer 2008 Management SqlStudio Error


I am just installed SqlServer 2008 and then i am getting error when i am exploring server in Management Studio

OS Windows 7 Home Premium.

I and then when i am lunched Management studio there am getting popup window with the willowing error:

Value cannot be null.
Parameter name: viewInfo (Microsoft.SqlServer.Management.SqlStudio.Explorer)

Here is detailed information of this error:


Value cannot be null.
Parameter name: viewInfo (Microsoft.SqlServer.Management.SqlStudio.Explorer)

Program Location:

at Microsoft.SqlServer.Management.SqlStudio.Explorer.ExplorerViewDescriptor..ctor(IFactoryService factoryService, INavigationViewInfo viewInfo, String urnPath, IDictionary`2 allEntities)
at Microsoft.SqlServer.Management.SqlStudio.Explorer.NavigationService.GetView(String urnPath)
at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.NavigableItemBuilder.<GetColumnsFromNavigationService>d__f.MoveNext()
at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.NavigableItemBuilder.AddFields(List`1 list, IEnumerable`1 fields, IDictionary`2 allValidFields, AddFieldsFlags flags)
at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.NavigableItemBuilder.GetF

Microsoft JScript runtime error: Object doesn't support this property or method



When I am updating dropdown of parent window from popup it shows error JScript runtime error. But I can able to clear the dropdown. When I am adding only the problem is occuring. I have pasted the code below

var ddlVendor = window.opener.aspnetForm.document.getElementById('ctl00_DefaultContent_ddlVendor');

//Clears the state combo box contents.

for (var count = ddlVendor.options.length-1; count >-1; count--)


ddlVendor.options[count] =


var stateNodes = listNode.getElementsByTagName('Table1/UserName');

var stateIds = listNode.getElementsByTagName('Table1/Password');

How do you set the LocalConnectionString Max Database Size property on the RDA object in C++?


How do you set the LocalConnectionString Max Database Size property on the RDA object in C++?

We have an C++ application running under PPC 2003. The SQL Server Compact edition 3.5 service pack 2 is installed.

We have successfully created a local database using the DBPROP_SSCE_MAX_DATABASE_SIZE property and set the size to 386mb.

The local database can be written locally to up to the Max Database Size.

When we perform a Pull operation with the RDA object the Pull fails when we set the Max Database Size property on the RDA LocalConectionString.

When we perform a Pull operation with the RDA object the Pull succeeds when we set only the Data Source property. But we can only Pull up to 128mb (the default size).



Microsoft.SqlServer.Management.Sdk Error


I have a SQL Server 2000 database.  I am trying to ssetup a sqldatasource in Visual Web Developer 2008 Express.  I get an error saying "Microsoft.SqlServer.Management.Sdk.Sfc cannot be loaded".  Everything I can find says this is related to 2005 or 2008.  Any ideas what I can look for?




System.TypeLoadException: Could not load type 'Microsoft.SqlServer.Management.Smo.Agent.JobBaseColl


Hi All,

I am getting the following error while trying to invoke a DB JOB from my application code.

System.TypeLoadException: Could not load type 'Microsoft.SqlServer.Management.Smo.Agent.JobBaseCollection' from assembly 'Microsoft.SqlServer.Smo, Version=, Culture=neutral, PublicKeyToken=89845dcd8080cc91

I have installed my code in application server and the DB where the sql jobs are installed is in another server. (Different physical servers).

When I analysed, I could see that the Application server has Microsoft.SqlServer.Smo version in its GAC. The DB server has got both and versions of the same DLL in its GAC.

I wonder whether this can cause the issue.

Any help is appreciated.

With regards,

Using Microsoft.SqlServer.Management.Smo to backup from remote SQL Server to local drive.


I'm trying to use the Microsoft.SqlServer.Management.Smo class to connect to a remote SQL Server, perform a backup and save it to my local drive.

I currently can only connect to a remote SQL Server and backup and save the backup file to the remote SQL Server drives. The same happens when I connect to a local instance of SQL Server and backup a file, I can only save it to my local drive.

Is there a way to specify to the Microsoft.SqlServer.Management.Smo to save to the [local] or [remote] machines?

Patrick Miron

For more about Microsoft.SqlServer.Management.Smo, check out my other thread at http://social.msdn.microsoft.com/Forums/en-CA/sqlgetstarted/thread/656d522a-06a6-4475-8070-93df75ef83a5

how to retrieve data from microsoft access database using .net


i want to  know how to retrieve data from microsoft access database using vb .net

Installing SqlServer 2008 shared management object in Win Xp Sp3


Hello All,

I am not able to install SQL Server 2008 shared management objects,it showing me the message saying prerequisites required SQL Server 2008 System CLR Types.Even Though it is already been installed.Please help

While uninstalling i uninstalled clr types first then smo,now again while installing m able to install clr types but not smo,is this related.Please help

Thanks in advance

MVC architecture in ASP.Net using C# and Microsoft Data Access Application block

The Model-View-Controller (MVC) pattern separates the modeling of the domain, the presentation, and the actions based on user input into three separate classes [Burbeck92]:

Model. The model manages the behavior and data of the application domain, responds to requests for information about its state (usually from the view), and responds to instructions to change state (usually from the controller).

View. The view manages the display of information.

Controller. The controller interprets the mouse and keyboard inputs from the user, informing the model and/or the view to change as appropriate.

Data Types - Date and Time in SqlServer

Date and time values can be stored with either the DATETIME or SMALLDATETIME data type. The difference between the two is that SMALLDATETIME supports a smaller range of dates and does not give the same level of precision when accounting for time. The DATETIME data type can hold values from January 1st of 1753 to December 31st of 9999. The time is stored to the 1 three hundredths of a second and each value takes up 8 bytes of storage. The SMALLDATETIME data type can hold values between January 1st 1900 and June 6th of 2079. The time is tracked to the minute and each value takes up 4 bytes of storage. The majority of business applications can live happily with SMALLDATETIME, however, if you are in an environment where each second matters or you need to make estimates to the distant future (or past) then you have to resort to DATETIME. If you fail to specify the time when inserting a value into a DATETIME or SMALLDATETIME column, a default of midnight is used. If you fail to specify the date portion the default of January 1, 1900 is used.



Dear gentlemen and ladies of the Microsoft Dynamic Data Team,

Mr. Steve Naughton says (and I hope so) that there might be chances that you read the posts published in this forum: I really hope so.

If that were the case then I am formally requesting to you in providing a "real answer" to my question:

I want to customize a dynamic data page (the details one) so I can have access to the data it has been already gathered from the end user UI (details.aspx) and use it to pass this same data to the following controls/pages that I am going to display next time to the end user.

For instance:

I have a screen with different types of data in it: texts, numbers, dates, check boxes, radio buttons and dropdownlists that has been filled with data by the end user. I want now to reset all fields exept the dropdownlist of which I'd like to keep the previously chosen values(the very same thing you do between dropdownlist of List.aspx ad Details.aspx). Even with FoxPro I could do that because data and controls were available there. It was as simple as setting carrying on to true.


I have found my

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend