Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Kevlar1964
Starting Member
4 Posts |
Posted - 2011-10-11 : 10:18:12
|
| I running Sql server 2008 r2, under Dotnetnuke, IIS7 etcUnable to cast object of type 'System.DBNull' to type 'System.String'.ResourceName:Microsoft.WebMatrix.Server.WebManagementServiceException: Unable to cast object of type 'System.DBNull' to type 'System.String'. ---> System.InvalidCastException: Unable to cast object of type 'System.DBNull' to type 'System.String'. at Microsoft.SqlServer.Management.Smo.SqlSmoObject.GetDbCollation(String dbname) at Microsoft.SqlServer.Management.Smo.SqlSmoObject.GetDbComparer(Boolean inServer) at Microsoft.SqlServer.Management.Smo.SqlSmoObject.InitializeStringComparer() at Microsoft.SqlServer.Management.Smo.AbstractCollectionBase.get_StringComparer() at Microsoft.SqlServer.Management.Smo.SchemaCollectionBase.InitInnerCollection() at Microsoft.SqlServer.Management.Smo.SmoCollectionBase.InitializeChildCollection(Boolean refresh) at Microsoft.SqlServer.Management.Smo.SmoCollectionBase.GetEnumerator() at Microsoft.WebMatrix.DatabaseManager.SqlDatabase.SqlDatabaseProvider.GetTables(String connectionString) at Microsoft.WebMatrix.DatabaseManager.IisDbManagerModuleService.GetTables(Object databaseConnectionObject, String configPathState) --- End of inner exception stack trace --- at Microsoft.WebMatrix.Client.SharedMemoryChannel.InvokeInternal(String serviceName, String methodName, Object[] parameters) at Microsoft.WebMatrix.Client.SharedMemoryChannel.Invoke(String serviceName, String methodName, Object[] parameters) at Microsoft.WebMatrix.Client.ModuleServiceProxy.Invoke(String methodName, Object[] parameters) at Microsoft.WebMatrix.DatabaseManager.Client.IisDbManagerModuleProxy.GetTables(DatabaseConnection connectionObject, String configPathState) at Microsoft.WebMatrix.DatabaseManager.Client.ClientConnection.get_Tables() at Microsoft.WebMatrix.DatabaseManager.Client.TablesHierarchyInfo.GetChildrenInternal() at Microsoft.WebMatrix.DatabaseManager.Client.DatabaseHierarchyInfo.OnChildrenLoadingStarted(Object sender, DoWorkEventArgs e) |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-10-11 : 12:27:35
|
| looks like problem due to presence NULL values in a field which you're trying to cast to string. might be worth converting NULLs to some compatible values like '' in case of string or 0 in case of numeric etc------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
Kevlar1964
Starting Member
4 Posts |
Posted - 2011-10-11 : 12:28:28
|
| Would it help if I included the Database with the question?I can email the database if that would be helpful, it is not that big. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-10-11 : 12:30:10
|
| nope. just post the query you executed and tried to populate the recordset------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
Kevlar1964
Starting Member
4 Posts |
Posted - 2011-10-11 : 12:38:54
|
| I get this error when I try to access the database. I click on the database in WebMetrix, which displays options Tables, Views, and Stored Procedures. Then when I try to click on Tables or Views or Stored Procedures, at this point I get the error and it won't let me get any farther. |
 |
|
|
rajarajan
Starting Member
48 Posts |
Posted - 2011-10-11 : 12:46:09
|
| you may not have permission to view table and other thing i think u have only read only permissionselect ISNULL(columnName,0) from table |
 |
|
|
Kevlar1964
Starting Member
4 Posts |
Posted - 2011-10-11 : 12:58:23
|
| Thats the thing, I had permission before, nothing there has changed, since I am the only person using this database |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-10-11 : 14:24:34
|
| whats webmatrix by the way? is it third party client? Is it using SMO?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|
|
|