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 1014557
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:16:10+00:00 2026-05-16T10:16:10+00:00

Hi currently have the problem, that I want to insert values in a postgres

  • 0

Hi currently have the problem, that I want to insert values in a postgres database where the table contains self defined types like.

CREATE TYPE TestEnum AS ENUM ('Value1','Value2');

When I try to add a parameter in C# I always get an error because of the wrong NpgsqlDbType. So my question is what NpgsqlDbType to use for such self defined Types.

var parameter = new NpgsqlParameter(":p1", NpgsqlDbType.????)
{
    Value = "Value1",
    Direction = ParameterDirection.Input
}

Thanks for your help. I’m really going mad because of this problem.

  • 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-05-16T10:16:10+00:00Added an answer on May 16, 2026 at 10:16 am

    After all, I found a solution that solves the problem, although it’s not the real solution.
    I now add a NpgsqlDbType.Varchar parameter and add a CAST(:p1 as “TestEnum”) to the SQL

    e.g.

    INSERT INTO tableName (Col) VALUES ( CAST(:p1 as "TestEnum") )
    

    It works for me, although I do not think that this is a very nice solution due to the cast.
    If someone will find a better solution in future, please drop me a line. 😉

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

Sidebar

Related Questions

I have a problem that output string must be utf8-formatted, I am writing currently
I'm currently exploring powershell capabilities, but I have encountered a problem that I have
I currently have a problem attepting to update a record within my database. I
I currently have a problem within PHP where I want to sort these posts
I have a table message in a database that has almost a million rows.
I have a table with a row that looks like this: ( 20091231 48498429,
I have a Questions table which looks like that as you see, there are
I have following table structure there is column vid in that i want entry
Possible Duplicate: SmartGWT Dialog title not set correctly I have a problem, is that
I currently have a problem with my jgroups configuration, causing thousands of messages getting

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.