Could not load Microsoft.SqlServer.BatchParser

  • I am pretty new to SQLServer and C# so this may be a dumb question.

    I have created a simple application using C# (Started with the Express Edition 2008 now using VS Standard 2008) that automates a number of steps in upgrading our product on a customer's server. One of these steps involves updating the database schema, changing some data and references, etc. I chose to do this part using the SMO libraries. Everything works fine with SQLServer 2005 but at least one of our customers is still running SQLServer 2000. This customer is getting the following error on the first SQL command being executed (ALTER TABLE acct DROP CONSTRAINT UQ__acct__2D27B809):

    [font="Courier New"]ExecuteNonQuery failed for Database 'bonuat'. Could not load file or assembly 'Microsoft.SqlServer.BatchParser, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)[/font]

    I have since created a SQLServer 2000 test environment and replicated the issue. I have tried numerous things such as explicitly including the Microsoft.SqlServer.BatchParser.dll in the project and copying out with the build but I cannot get rid of this error.

    I am beginning to suspect that this error is actually coming from SQLServer which is why adding the DLL to my application didn't help. Am I going to have to rewrite the app using predecessor to SMO (I forget its name)?

    I would appreciate any assistance you can give me on resolving this.

  • I posted this over in the TechNet forums as well and got a reply that directed me to this MS Feedback topic:

    https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=119402&wa=wsignin1.0

    Unfortunately, this looks like it might be a known issue related to the loading of specific versions of resources but MS has closed the ticket without actually fixing it.

    Thought I post that here as well to see if it would jar anyones memory.

  • Ron:

    I am not convinced that that MS issue has anything to do with your problem since it was talking about assembly mismatches during serialization tasks.

    I have sucessfully used SMO on SQL 2000 servers, though I cannot remember if I used ExecuteNonQuery or not. I have definitely been sucessful using ExecutWithResults.

    Have you tried installing .net Framework 2.0 on the 2000 server?

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

  • I haven't tried that because we really don't have control over the SQL server -- it is provided and supported by the customer. Doesn't mean I couldn't ask them to do it though. I'll try that in my test environment and, if it resolves the issue, I can pursue it with the customer.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply