Note that there are some explanatory texts on larger screens.

plurals
  1. POError while inserting into database c#, Data Conversion Failed
    primarykey
    data
    text
    <p>While trying to do an insert statement into my table, I get this error:</p> <blockquote> <p>Data conversion failed. [ OLE DB status value (if known) = 2 ]</p> </blockquote> <p>I have done my research online and seem to not be able to find an answer to solve this problem. </p> <p>The insert statement looks like this:</p> <pre><code>INSERT INTO [Beverages] (BeverageID, ParentBeverageID, Name, PreferredRecipeVersion, SpecificCustomerID, AcceptabilityRating, ShowBeverage, Availability, Family, EngagedPriority, SmilePriority, Collections) VALUES (1475614, 1475633, 'Caffeine-free', 3, 1, 0, 1, 1, 'A', 'NULL', 1, 'UK') </code></pre> <p>My initial build of the table (which does create it) looks like this:</p> <pre><code>string beverages = "CREATE TABLE [Beverages]([BeverageID] INT NOT NULL,[ParentBeverageID] INT, [Name] NVARCHAR(40) NOT NULL,[PreferredRecipeVersion] INT NOT NULL DEFAULT(1),[SpecificCustomerID] INT NOT NULL DEFAULT(0),[AcceptabilityRating] INT NOT NULL DEFAULT(0),[ShowBeverage] INT NOT NULL DEFAULT(1),[Availability] INT NOT NULL DEFAULT(1),[Family] NVARCHAR(1),[EngagedPriority] INT,[SmilePriority] INT NOT NULL DEFAULT(0), [Collections] NVARCHAR(50) NOT NULL);"; string beverages1 = "ALTER TABLE [Beverages] ADD CONSTRAINT [PK__Beverages__000000000000134A] PRIMARY KEY ([BeverageID]);"; string beverages2 = "CREATE INDEX [PK_BeverageID] ON [Beverages] ([BeverageID] ASC);"; db.ExecuteSqlCommand(beverages, null, __gulfstreamDataConn); db.ExecuteSqlCommand(beverages1, null, __gulfstreamDataConn); db.ExecuteSqlCommand(beverages2, null, __gulfstreamDataConn); </code></pre> <p>I don't know what would be causing this issue, but thanks for the help in advance!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload