Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8012591
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:22:16+00:00 2026-06-04T19:22:16+00:00

I’m using C# for a custom action in wix, which works fine. The custom

  • 0

I’m using C# for a custom action in wix, which works fine. The custom action essentially just runs sql scripts based on the parameters passed to a method.

One of the scripts I’m running populates one of my tables with data, if there’s nothing in it, and looks something like this:

IF (SELECT COUNT(*) FROM [dbo].[Table]) = 0
BEGIN

INSERT [dbo].[Table] ([ItemId], [Description]) VALUES (N'<<GUID>>', NULL)
INSERT [dbo].[Table] ([ItemId], [Description]) VALUES (N'<<GUID>>', N'The 2nd Item')

...

END

In this instance <<GUID>> is something like e00104e4-7e5f-4563-9356-30732d5ca57e – these scripts were generated from data exports of SQL Server 2008 R2 using the corresponding edition of Management Studio.

When I run this script in Management Studio, it works fine and as expected, all the data gets inserted if there is nothing already there. Running it via the C# code, however, and I get the following exception:

Conversion failed when converting from a character string to uniqueidentifier

As the only uniqueidentifier column in the table, this has to be the ItemId column, but I can’t figure out why this is happening, or how to resolve the issue, and the last hour searching online hasn’t given anything either.

EDIT

I should add that these SQL queries are located in a file, which the C# code then reads the content of as the SQL query. I don’t really want to have to modify them if I can help it, as it adds an extra step that shouldn’t be needed.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T19:22:17+00:00Added an answer on June 4, 2026 at 7:22 pm

    I’ve resolved the issue now. Turns out that one of the scripts was out of date, and the ID of that table had been changed from an nvarchar to a uniqueidentifier.

    2 things then happened, the first was that nobody else updated the script that populated that tables default data. The 2nd was that wix (or the custom action running the SQL, I’m not sure exactly which) was reporting the error after the first script, which happens to have a very similar table structure.

    So, in all, I should’ve spotted what the issue was sooner. Instead, I get to have made a fool out of myself on SA for not doing so. Thanks for the answers anyway, hopefully they’ll be of use to someone who stumbles across this question.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I would like to run a str_replace or preg_replace which looks for certain words

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.