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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:23:10+00:00 2026-06-11T09:23:10+00:00

If possible I would like to increment a number on the application side and

  • 0

If possible I would like to increment a number on the application side and save to the database using c# and Linq.

So for example I have a table like so:

|id|text|version|
-----------------
 1  hello   1
 2  hello   1

When inserting a new record into this table I want to get the current version number and increment by 1 then insert a new row

|id|text|version|
-----------------
 1  hello   1
 2  hello   1
 1  hello   2

I can do a standard insert using linq but obviously stuck with what to do with the version

DataContext db = new DataContext

using (db)
{
    table t = new table
      {
         text = TextBox1.Text
         version = ??
      };

db.table.InsertOnSubmit(t);
db.SubmitChanges();
}

Can I somehow select the row and get the current version number and then just increment by 1? Or should I just re-think my approach?

Thanks

  • 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-11T09:23:11+00:00Added an answer on June 11, 2026 at 9:23 am

    I had the liberty to change the database structure so I just used IDENTITY col.

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

Sidebar

Related Questions

Is it possible to find repeating patterns in the text? My table looks like
Is it possible to do something like this in Python using regular expressions? Increment
I have an XSLT script which I would like to number things sequentially each
I would like to know if it would be possible to replicate the effect
I would like to know how is possible to read a file placed in
I would like to know if its possible to write a nested select statment?
I would like to know if its possible to clear the current information stored
I would like to kwnow if it possible for users to add validation rules
I would like to make it possible to redirect users from a site to
I would like to include an audio/possible video player on my website with the

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.