Just use LastInsertedId field
MySqlCommand dbcmd = _conn.CreateCommand();
dbcmd.CommandText = sqlCommandString;
dbcmd.ExecuteNonQuery();
long imageId = dbcmd.LastInsertedId;
More Related Contents:
- Is it possible to use a MySql User Defined Variable in a .NET MySqlCommand?
- ASP.NET use SqlConnection connect MySQL
- Convert DateTime for MySQL using C#
- Get affected rows on ExecuteNonQuery
- How to pass a table as parameter to MySqlCommand?
- Could not load file or assembly ‘MySql.Data, Version=6.2.2.0
- Priority queue in .Net [closed]
- How to shut down the computer from C#
- Configuration System Failed to Initialize
- Why is .Contains slow? Most efficient way to get multiple entities by primary key?
- How should I inject a DbContext instance into an IHostedService?
- Thread.Sleep for less than 1 millisecond
- Enforce an async method to be called once
- Why does ReSharper want to use ‘var’ for everything? [duplicate]
- How to flatten nested objects with linq expression
- How to convert Javascript datetime to C# datetime?
- Wrap C# application in .msi installer
- IEqualityComparer for SequenceEqual
- Entity Framework – Invalid Column Name ‘*_ID”
- ‘AssemblyTitle’ attribute in the .NET Framework
- How do you resize a form to fit its content automatically?
- Why are interfaces not [Serializable]?
- What does this C# code with an “arrow” (=>, an equal sign and greater than sign) mean and how is it called?
- Redirect stdout+stderr on a C# Windows service
- WinForms DataGridView – databind to an object with a list property (variable number of columns)
- Prevent from displaying of Windows Security window
- How do I get a return value from Task.WaitAll() in a console app?
- How to convert DataTable to class Object?
- Make a form’s background transparent
- .Net Excel Interop Deleting a worksheet