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

  • Home
  • SEARCH
  • 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 8806049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T02:01:15+00:00 2026-06-14T02:01:15+00:00

This is my initial SQLite database CREATE TABLE [Categories] ( [ParentId] INT, [Name] VARCHAR(100));

  • 0

This is my initial SQLite database

CREATE TABLE [Categories] (
  [ParentId] INT, 
  [Name] VARCHAR(100));

CREATE TABLE [Fees] (
  [CategoryId] INT, 
  [Name] VARCHAR(100), 
  [Value] VARCHAR(50), 
  [Info] VARCHAR(200));

CREATE TABLE [Markups] (
  [CategoryId] INT, 
  [UpTo] MONEY, 
  [Value] VARCHAR(50), 
  [Info] VARCHAR(200));

If I run DbMetal /provider:Sqlite /conn "Data Source=bms4.db3" /dbml:Model.dbml, it will successfully create the dbml file.

But if I add a Foreign Key, such that

CREATE TABLE [Fees] (
  [CategoryId] INT CONSTRAINT [fk_fees_categories] REFERENCES [Categories]([rowid]), 
  [Name] VARCHAR(100), 
  [Value] VARCHAR(50), 
  [Info] VARCHAR(200));

Running the same command

DbMetal /provider:Sqlite /conn "Data Source=bms4.db3" /dbml:Model.dbml

will give this error:

>>> Reading schema from SQLite database
DbMetal: The given key was not present in the dictionary.

How can I introduce a Foreign Key relationship into the DBML?

  • 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-14T02:01:16+00:00Added an answer on June 14, 2026 at 2:01 am

    Foreign keys are checked against a unique key in the constraint. You have not declared a primary key or unique key so you need to start by doing that (It is good practice to make sure that each table has a primary key)

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

Sidebar

Related Questions

I'm using the method explained in this blogpost to create the initial populated database
I'm using FMDB to create a SQLite database on iPhone. I have a initial.sql
heelo this is my connection string <connectionStrings> <add name=DefaultConnection connectionString=Data Source=.\SQLEXPRESS;Initial Catalog=Test;Integrated Security=True providerName=System.Data.SqlClient;Password=;User
I'm using SQLite to maintain a database which contains, among other things, a table
How to specify initial 'soft' values for the model? This initial model is the
I'll like to combine both my initial problem which leads me to this one
How do I suppress all of Logback's initial output? This question has been asked
FYI, There is some overlap in the initial description of this question with a
I'm using SQLite, and I have a table for properties, and a table for
I am using sqlite to create and connect to a sqlite db foo.db When

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.