© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
3 replies
TheBrambleShark

LINQPad 7 - Insert Record [Answered]

Hi all, I'm using LINQPad to insert records from json into a SQL database.
All of the documentation seems to suggest that it builds a model based on the table that is a singular name of the table (e.g., if the table name is Regions, the model is named Region).

However, this does not seem to be the case for my table, and unfortunately LINQPad seems to lack any sort of intellisense for inspecting the namespace for the correct type name. My table is RVIDocumentCodes but there does not appear to be an RVIDocumentCode type.

The
InsertOnSubmit()
InsertOnSubmit()
line has an expected error because jsonDocument is the json model. This error is
"Cannot convert from UserQuery.RVIDocumentCodeJson to LINQPad.Users.RVIDocumentCodes".

This tells me that the RVIDocumentCodes type is my model, but there does not appear to be a constructor that I'm allowed to consume. Both of these lines tell me that RVIDocumentCodes doesn't contain a constructor that accepts that many arguments.
foreach (var jsonDocument in documents)
{
    // var document = new RVIDocumentCodes(jsonDocument.DocumentCode, jsonDocument.DocumentTitle, jsonDocument.DocumentUrl);
    var document = new RVIDocumentCodes(0, jsonDocument.DocumentCode, jsonDocument.DocumentTitle, jsonDocument.DocumentUrl);
    RVIDocumentCodes.InsertOnSubmit(jsonDocument);
}
SubmitChanges();
foreach (var jsonDocument in documents)
{
    // var document = new RVIDocumentCodes(jsonDocument.DocumentCode, jsonDocument.DocumentTitle, jsonDocument.DocumentUrl);
    var document = new RVIDocumentCodes(0, jsonDocument.DocumentCode, jsonDocument.DocumentTitle, jsonDocument.DocumentUrl);
    RVIDocumentCodes.InsertOnSubmit(jsonDocument);
}
SubmitChanges();


What am I missing here?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

Can't access record members [Answered]
C#CC# / help
4y ago
✅ AutoMapper - mapping record to a class (.NET 7)
C#CC# / help
3y ago