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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:20:46+00:00 2026-05-25T15:20:46+00:00

I am using mysql/ado.net/C# heres my problem I know mysql is concurrent, however i

  • 0

I am using mysql/ado.net/C# heres my problem
I know mysql is concurrent, however i have file data (the thumbname name) and db data (the row) to be in sync.

If i start a transaction and it fails for any reason will this be a problem? If i have this code ran at the same time on two cores will they clobber eachother? I essentially need to know if 1) the last_insert_id is dependable on not changing. 2) if one transaction uses said rowid that another transaction wont use it.

start transaction
insert statement, however i dont want it to be active yet;
select LAST_INSERT_ID()
File.Delete(lastid)//may exist from a transaction that failed
File.Move(thumbImage, lastid)
transaction.commit()//ok done

Is this safe? Why or why not?

  • 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-25T15:20:46+00:00Added an answer on May 25, 2026 at 3:20 pm

    MySQL’s last_insert_id() is dependable in that it’s always the LAST insert performed by THAT PARTICULAR connection. It won’t report an insert id created by some other connection, it won’t report an insert that you did two connections ago. It won’t matter which cpu core the actual insert occured on, and which core the last_insert_id() call is processed on. It will always be the right ID number for that connection.

    If you roll back a transaction that did an insert, last_insert_id() will STILL report that new id, even though it no longer exists. The id will not be reused, however, in a subsequent insert

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

Sidebar

Related Questions

I have problem while connecting to mysql database using ADO.NET Driver for MySQL (Connector/NET)
I have a C# .NET 3.5 application using the ADO.NET Driver for MySQL (Connector/NET).
Using MySQL, I have three tables: projects : ID name 1 birthday party 2
Can I connect to a Ubuntu server, that is running MySQL using ADO.NET or
I have a C# application, using ADO.Net to connect to MSSQL I need to
long-time listener, first-time caller! I’m trying to connect to MySQL using the ADO.NET Entity
I am trying to generate my ADO.NET entity model from my MySQL database using
I am using an ADO .Net Entity Model for querying a MySQL database. I
I've added and designed an ADO.NET Entity Data Model (.edmx) and have generated the
I want to run my .sql script file using my ASP.NET website through ADO.NET.

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.