.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

Restore error: specified cast is not valid

Posted By:      Posted Date: September 27, 2010    Points: 0   Category :Sql Server
I've got a database from a client (SQL 2008) and when I try and restore the database to my server, I get the following error: specified cast is not valid...

I get the error as I browse for and select the backup file.

Please help!!!

View Complete Post

More Related Resource Links

Stsadm Backup/Restore Error! "operation is not valid due to the current state of the object "



I am facing problem while taking a backup of my SharePoint 2010 site using stsadm command after taking 75% backup it shows "operation is not valid due to the current state of the object " error message. While it is working on my different sharepoint server. I am using SharePoint 2010 RTM.

Thanks & Regards, Satish Srivastava

Cast error when inserting record with Linq (to Sql)



I'm getting  the following error message: 

Unable to cast object of type 'System.Data.Linq.DataQuery`1[Username]' to type 'Username'.

I've been searching but can't find a solution.  This particular table has 4 columns. The first column is the int indentifier.  Column 2 is "username" (varchar50) and is the primary key.  Column3 is "userID" (uniqueidentifier) and column 4 is "active" (varchar5) .

            Dim dc As New DataClassesDataContext
            Dim c3 As New Username With {.userID = userGuid, _
                                    .username = userCustomName, _
                                    .active = "False"}


        Catch ex As Exception
            Throw ex
        End Try


override error message (The value 'test' is not valid for Age) when input incorrect data type for in


Hello everyone,

I've tried to override error message when input incorrect data type in input field on HTML form. For example I have the model like this.

public class Person
public string FirstName {get;set;}
public int Age {get;set;}


For view, I put text input for Age to get it value.

When type some string in Age text box like 'test' and press submit button. I got this error message

The value 'xxx' is not valid for Age

However, I want to change this message and try many way. There 's nothing effect this message value.

Please could you help me to solve this problem.

Error in RESTORE in LOG FILE. Anyway to exclude it?

I'm trying to install a database (on a SQL Server 2008 machine) with test data sent by a partner company in the form of a .BAK file. (Version of SQL Server they are using unknown). I'm using this script: Use Master RESTORE DATABASE XEMS FROM DISK = 'C:\temp\xemstest6-29.bak' WITH REPLACE, MOVE 'XEMS' TO 'E:\XEMS DATABASE\XEMS.MDF', MOVE 'XEMS_Log' TO 'E:\XEMS DATABASE\XEMS_Log.LDF' The Restore process churns for a while, then I get: Processed 2576 pages for database 'XEMS', file 'XEMS' on file 1. Processed 5 pages for database 'XEMS', file 'XEMS_log' on file 1. Msg 3283, Level 16, State 1, Line 2 The file "XEMS_log" failed to initialize correctly. Examine the error logs for more details. Msg 3013, Level 16, State 1, Line 2 RESTORE DATABASE is terminating abnormally. At this point the database is unusable - trying to do anything with it produces an error indicating the database is still in a Restore state. There is some problem with the LOG portion of the backup, which I really don't need anyway. I'd like to just NOT restore the log. Came across this article which seemed to refer to the exact problem I'm having...  http://support.microsoft.com/kb/915385/en-us They offered this suggestion: "Use the WITH NO_LOG clause during the restore process." However - in checking the RESTORE syntax.... http://msdn.microsoft.com/en-us/libr

Help with error "The AdomdDataReader object is not positioned at a valid row"

I have a PerformancePoint grid from which users can drillthrough into records in the underlying cube.  The cube itself imposes no limit on the number of records returned by drillthrough.  The server has a limit of 10,000 drillthrough records.  The Analysis Services build is 10.0.2531.0  In any event, the drillthrough itself always works, but when the number of records is large (say, 6000 or so), users receive the following error when attempting to export the results to excel: Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.InvalidOperationException: The AdomdDataReader object is not positioned at a valid row. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [InvalidOperationException: The AdomdDataReader object is not positioned at a valid row.] Microsoft.AnalysisServices.AdomdClient.AdomdDataReader.InternalGetValue(Int32 ordinal) +423 Microsoft.AnalysisServices.AdomdClient.AdomdDataReader.GetString(Int32 ordinal) +7 Microsoft.PerformancePoint.Analytics.WebC

DontSaveSensitive; Key not valid for use in specified state error

I initially had my packages set to 'EncryptSensitivewithPassword' and usedthe config files.  My job executes fine.  But I noticed I was getting THE error "......Key not valid for use in specified state.....".  So, I change the protection level to 'DontSaveSensitive' , saved packaged ,build and re-imported it.  And I still get the same result. What am I doing wrong??   Package is on the same server where it was built. I have a package in production that executes without the error.  I made a change to the package (logging) in test and now it also encounters same error as the package referenced above.

Interesting error message with content organiser: Cannot resolve mailbox (null) to a valid user

Here is a site with content organiser site feature enabled, as well as the email integration feature. Emails are successfully delivered to the "Submitted Email Records" list, but is never routed to the Drop Off Library. (the content organiser web service works fine and the drop off library works as a custom send to destination and happily processes its rules. If I turn up the debug juice I get the error "Cannot resolve mailbox (null) to a valid user" for every item in any "Submitted Email Records" in the site collection. Area: Document managagement Category: Content organiser EventID: 8000 Message: Cannot resolve mailbox (null) to a valid user I have temporarily worked around the problem by email enabling the drop off library but it creates an intermittent race condition (similar to certain workflow and event receiver situations), so its not a real solution (and in fact I assume thats why the Submitted Email Records hidden list exists in the first place). I've run procmon, specifically focusing on OSWTIMER and nothing interesting shows up at all. The error message is intriguing and I can't really think of what it is trying to do. In troubleshooting I noted that this farm had configured inbound email but not outbound email. I have since rectified this and de/reactivated the content organiser features and reset the timer service and IIS, b

Databind on Gridview throwing System.InvalidCastException. Specific Cast Not Valid

Hello, I am working on a web app where when the user enters data into a text box and presses a filter radio button it should filter the Gridview on the page to the criteria entered.  I have done this before in previous applications with the same code listed below, but for some reason I am now getting the InvalidCastExeption error.  Any help would be appreciated, the source database is SQL and the data field is set to nvarchar and I am using a string to compare as you will see in the code.  I am just unsure why this worked in the past and is not working in this scenario. Thanks, Pete protected void filterLName_CheckedChanged(object sender, EventArgs e) { SHCDataContext existingCustomers = new SHCDataContext(); var filterExistingCustomers = existingCustomers.Customers.Where(c => c.custLastName.Contains(lNameTB.Text.ToString())); displayCustGV.DataSource = null; displayCustGV.DataSourceID = null; displayCustGV.DataSource = filterExistingCustomers; displayCustGV.DataBind(); }   Here is the stack trace....  Specified cast is not valid. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.I

restore BD error

I have pulled a copy of the Dot Net Nuke database off the servera nd i want to put it on my local machine.... I am getting this error (Microsoft.SqlServer.SmoExtended) System.Data.SqlClient.SqlError: File 'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\Childrens.mdf' is claimed by 'CHRBenefitsDNN_log'(2) and 'CHRBenefitsDNN'(1). The WITH MOVE clause can be used to relocate one or more files. (Microsoft.SqlServer.Smo) I have dropped the old DB that was assosiated with DNN any ideas thanks in advance

[Odd]Specified cast is not valid exception

protected float getUserBalance() { string AccountNo = Session["AccNo"].ToString(); myConnection.Open(); float balance = 0; try { OleDbCommand getBalance = new OleDbCommand("Select Balance from BankTransaction where AccountNo = '" + Session["AccNo"] + "'", myConnection); //OleDbDataReader rdrBalance = getBalance.ExecuteReader(); //while (rdrBalance.Read()) //{ // balance = rdrBalance.GetFloat(0); //} balance = float.Parse(getBalance.ExecuteScalar().ToString()); } catch { balance = 0; } myConnection.Close(); return balance; } ===============These are my codes, and it work fine, balance will has a right value, but if I comment the line "balance = float.Parse(getBalance.ExecuteScalar().ToString());"and decomment the 5 lines above, get rid of try catch, I get the error:"Specified cast is not valid"Here is the some informations when I addwatch rdrBalance-        rdrBalance    {System.Data.OleDb.OleDbDataReader}    System.Data.OleDb.OleDbDataReader+        base    {System.Dat

Stuck during restore process, no error messages

I need to restore a solution (a webpart) from a Sharepoint 2010 backup to another Sharepoint 2010 installation on another server. In CA and exactly in the page _admin/BackupStatus.aspx I see that: A backup or restore is currently in progress. There are no current or recent backup or restore processes to show. If you recently started a backup or restore process, you may need to refresh this page after several minutes for it to appear. Hours have passed since I started the restore process In _admin/ServiceRunningJobs.aspx there is no backup/restore job running. The question is: What can I do to try again a restore if I cannot stop the restore that is "running"? Please Help.  

The URL is not valid error while publishing InfoPath form to MOSS 2007 server

Hi All,   When I try to publish the form onto a SharePoint Team site it throws the error: The following URL is not valid : http://tcs037288:6543/sites/projectmanagement   I have checked the comaptibility, trust and everything looks fine. Also, I tried to upload this template from Central Admin but there it is failing with browser-compatibility errors.       Regards,

Backup failing - Error "operation is not valid due to the current state of the object" ...........Ca

Hi, I am having a problem backing up a site collection, when trying to backup the collection I get the following error  "operation is not valid due to the current state of the object"............. "Category Info :InvalidData" . I'm getting the same error whether I use CA "granular backup" or "Farm backup", and using either STSAMD or Powershell. I can backup CA or the mysite collection but not the Home Portal site collection. As this is a production system I am really worried that something is going to happen and I'll have no backup. Does anyone have any suggestions on what i can do to either fix the problem or an alternative way to backup the collection or farm.  P.S. I am not using the "UseSQLSnapshot" parameter. Any ideas ? 

Error when running an SQL script to restore a database on SQL Server 2008 R2 Express

Hi, At work, I use SQL Server 2008 Express running on Windows XP Professional Service Pack 3. At home, I also use SQL Server 2008 Express running on Windows XP Professional Service Pack 3. Whenever I do work on the database at work, I usually restore the database at home (or vice versa) I have been using the following SQL scripts to back up the database and to restore the same database (at work or at home). BackupRealEstate.sql USE Master BACKUP DATABASE [RealEstate] TO DISK = N'F:\My Documents\My Database\RealEstate.bak' WITH NOFORMAT, INIT, NAME = N'RealEstate-Full Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10 GO RestoreRealEstate.sql USE Master RESTORE DATABASE [RealEstate] FROM DISK = N'F:\My Documents\My Database\RealEstate.bak' WITH  FILE = 1, NOUNLOAD, REPLACE, STATS = 10 GO Everything worked fine until I replaced my 8yo home computer with a newer and faster one. My new home computer is running Windows 7 Home Premium and I use the latest SQL Server 2008 R2 Express. When I tried to run the above restore SQL script, I got the following error message: Msg 3101, Level 16, State 1, Line 2 Exclusive access could not be obtained because the database is in use. Msg 3013, Level 16, State 1, Line 2 RESTORE DATABASE is terminating abnormally. There was no other application/process using this database. Can someone please help me? Regards,

Error during database restore

Hi,I'm trying to restore a database backup but I get this error.  What does it mean exactly?Thanks!TITLE: Microsoft SQL Server Management Studio------------------------------ Restore failed for Server 'WHIDBEY1'.  (Microsoft.SqlServer.Smo) For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.1314.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Restore+Server&LinkId=20476 ------------------------------ADDITIONAL INFORMATION: An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo) ------------------------------ The media set has 2 media families but only 1 are provided. All members must be provided.RESTORE DATABASE is terminating abnormally. (Microsoft SQL Server, Error: 3132) For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.1314&EvtSrc=MSSQLServer&EvtID=3132&LinkId=20476 ------------------------------BUTTONS: OK------------------------------

Restore SQL 2008 db error

hi all, i'm trying to restore a .bak to my laptop using sql express 2008. The .bak file is a backup from sql 2008 server. I get this error: TITLE: Microsoft SQL Server Management Studio ------------------------------ An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo) ------------------------------ ADDITIONAL INFORMATION: The media family on device 'D:\training _evaluation.bak' is incorrectly formed. SQL Server cannot process this media family. RESTORE HEADERONLY is terminating abnormally. (Microsoft SQL Server, Error: 3241) For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.1399&EvtSrc=MSSQLServer&EvtID=3241&LinkId=20476 ------------------------------ BUTTONS: OK ------------------------------ Could anybody help me please? Thanks, Paul.

BDC model in Search Server 2010 indexing error - Error while crawling LOB contents. ( Not a valid Wi

I have created a .NET connector assembly that pulls data from an in-house .asmx web service.  I have successfully created an external list in a search center site that displays this data without problem.   However, I've run into an error and a warning when indexing this list in search server 2010 for which I cannot find much information.  I've configure a content source with LOB data as the content source type and select my external data source from the list. After running a full crawl, I receive this error: Error while crawling LOB contents. ( Not a valid Win32 FileTime. ) And this warning: The content for this address was excluded by the crawler because this item was marked with a no-index meta-tag. To index this item, remove the meta-tag and recrawl. My .NET connector assembly looks like this:   public static WeatherEntity ReadItem(string id) { foreach (WeatherEntity entity in GetAllEntities()) { if (entity.LocationAbbreviation == id) { return entity; } } return null; } public static IEnumerable<WeatherEntity> ReadList() { return GetAllEntities().ToArray(); } public static List<WeatherEntity> GetAllEntities() { List<WeatherEntity> weatherEntities = new List<WeatherEntity>(); WeatherService.WeatherWS service = new WeatherService.WeatherWS(); WeatherService.DsWeatherDa
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