title: Exception:Failed to convert parameter value from a Guid to a String
body: <p>I have a problem while creating a web application using LinqTemplate here is the explanation step wise....</p>
  
  <ol>
  <li>I have created a database with a table name UserTest with one column name UserId with uniqidentifier datatype</li>
  <li><p>I have created a classLiberary Project where i have used LinqTemplate of subsonic for code Generation of DAL and created a partial class for UserTest</p>
  
  <pre><code>public partial class TestUser:Classes
  {
      public int Insert(TestUser user)
      {
        NFSLicensingSystemDB db = new NFSLicensingSystemDB();
        return  db.Insert.Into&lt;TestUser&gt;
             ( 
             x =&gt; x.UserId
  
             )
          .Values(
            user.UserId
          ).Execute();
      }
  
  }
  </code></pre></li>
  <li><p>I have created a web project in same solution and created a page UserTest.aspx with a button
  UserTest.aspx code for the page:-</p>
  
  <pre><code> &lt;html xmlns="http://www.w3.org/1999/xhtml" &gt;
      &lt;head runat="server"&gt;
          &lt;title&gt;Untitled Page&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;form id="form1" runat="server"&gt;
          &lt;div&gt;
          &lt;asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" /&gt;
          &lt;/div&gt;
          &lt;/form&gt;
      &lt;/body&gt;
   &lt;/html&gt;
  </code></pre></li>
  </ol>
  
  <p>4.UserTest.aspx.cs
  Here Database is a connection String Name code for OnButton Click event</p>
  
  <pre><code>    protected void Button1_Click(object sender, EventArgs e)
      {
          Datadase.TestUser test =new Datadase.TestUser();
          test.UserId = Guid.NewGuid();
          test.Insert(test);
  
      }
  </code></pre>
  
  <p>Now when I Build the project it build successfully and when i run the project it shows
  the UserTest.aspx page with a button but when i click on button it must insert the new guid value into the table but
  it throws an exception</p>
  
  <pre><code>[InvalidCastException: Object must implement IConvertible.]
     System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider) +2560525
     System.Data.SqlClient.SqlParameter.CoerceValue(Object value, MetaType destinationType) +414
  
  [InvalidCastException: Failed to convert parameter value from a Guid to a String.]
    TestPages.UserEdit.btnCreateNewAccount_Click(Object sender, EventArgs e) in D:\TestPages\UserEdit.aspx.cs:61
     System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
  </code></pre>