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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:05:21+00:00 2026-06-11T12:05:21+00:00

In my Global.asax file, under my ApplicationStart() function I want to drop a table

  • 0

In my Global.asax file, under my ApplicationStart() function I want to drop a table and recreate it cleanly when application starts. What is the best way to accomplish this so it is seamless every time i start my program? To get a better idea, I am keeping track of online users in a table, but when the application starts up again, obviously I would like to clear this table out. I need to drop and recreate the table because the identity seed won’t start over if i simply truncate it (I am using sql azure so i cannot run a db command to reset the seed). Also, if i did just truncate my table, would not resetting the seed be a bad practice? I’ve done this and im already at like id 1000, just after testing.

  • 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-11T12:05:22+00:00Added an answer on June 11, 2026 at 12:05 pm

    You can do a normal SQL TRUNCATE command, using the ExecuteStoreCommand method.
    Just like this dbContext.ExecuteStoreCommand("TRUNCATE TABLE myTable"); . Truncate deletes all records from table and resets the seed for auto id.

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

Sidebar

Related Questions

I want to loop through my javascript files. In the global.asax file on application
I have an Application Object. In Global.asax file i use this: Application[obj] = test;
When to use and not to use global.asax file in asp.net application? I heard
I created a global.asax file for an asp.net application. I run some code in
I have some code in the global.asax file in my application. Each time I
I have a about 10 application variable counters in Global.asax for displaying the file
I am developing and intranet web application. In Global.asax file's session_start event I get
I am using webformrouting in my asp.net c# application. In my global.asax file i
I have setup a routing table in the global.asax file for images that have
How can i get my lightswitch application to enter the global.asax file? In 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.