int a = 5;
int b = 10;
std::cout << "A = " << a << "\n";
std::cout << "B = " << b << "\n";
a ^= b;
b ^= a;
a ^= b;
std::cout << "A = " << a << "\n";
std::cout << "B = " << b << "\n";
Output:
A = 5 B = 10 A = 10 B = 5
Microsoft AX 2012, X++, C#, SQL server, SSRS, Java, JavaFX, Oracle, PL/SQL, Delphi - codes examples, step-by-step tutorials, experiences.
int a = 5;
int b = 10;
std::cout << "A = " << a << "\n";
std::cout << "B = " << b << "\n";
a ^= b;
b ^= a;
a ^= b;
std::cout << "A = " << a << "\n";
std::cout << "B = " << b << "\n";
Output:
A = 5 B = 10 A = 10 B = 5
extern "C" __declspec( dllexport )
int math_add( int const d1, int const d2 ) {
return d1 + d2;
}
Test c++ console app:
#includeC# class:extern "C" __declspec( dllimport ) int math_add( int, int ); int main( int argc, char* argv[] ) { int i = math_add( 4, 5 ); std::cout << '\n' << i << '\n'; std::cout << "Press any key.."; std::cin.get(); return 0; }
using System.Runtime.InteropServices;
namespace test {
public class PILib {
[DllImport( "piMath.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int math_add( int _v1, int _v2);
}
}
Calling in c#:
private void button1_Click( object sender, EventArgs e ) {
int i = PILib.math_add( 3, 5 );
MessageBox.Show( i.ToString() );
}
Output:
DateTime minStartTime =
ListOfProcesesForKilling.Min( p => {
return p.StartTime;
} );
value += $"Min starttime: {minStartTime};";
public enum MinimizeActionEnum {
NONE = 0,
CLEAR = 1
}
public MinimizeActionEnum MinimizeAction { get; set; } = MinimizeActionEnum.NONE;
It is saved as INT by default:
"ReportParams": [
{
"Name": "pProdId",
"Description": "",
"MinimizeAction": 0
},
With using that attribute:
[JsonConverter(typeof(JsonStringEnumConverter))]
public MinimizeActionEnum MinimizeAction { get; set; } = MinimizeActionEnum.NONE;
the enum value will be stored as TEXT:
"ReportParams": [
{
"Name": "pProdId",
"Description": "",
"MinimizeAction": NONE
},
sqllocaldb iOutput:
MSSQLLocalDBMore details about selected:
sqllocaldb info MSSQLLocalDBOutput:
Name: MSSQLLocalDB Version: 15.0.4382.1 Shared name: Owner: domain\pirklj Auto-create: Yes State: Running Last start time: 14.10.2025 14:36:27 Instance pipe name: np:\\.\pipe\LOCALDB#FF67DE7F\tsql\queryList of installed DBLocal versions:
sqllocaldb versionsOutput:
Microsoft SQL Server 2016 (13.0.7037.1) Microsoft SQL Server 2017 (14.0.3391.2) Microsoft SQL Server 2019 (15.0.4382.1) Microsoft SQL Server 2022 (16.0.1000.6)Stopping and deleting of DBLocal instance, creating it with new higher version:
C:\Users\pirklj>sqllocaldb stop MSSQLLocalDB LocalDB instance "MSSQLLocalDB" stopped. C:\Users\pirklj>sqllocaldb delete MSSQLLocalDB LocalDB instance "MSSQLLocalDB" deleted. C:\Users\pirklj>sqllocaldb create MSSQLLocalDB LocalDB instance "MSSQLLocalDB" created with version 16.0.1000.6. C:\Users\pirklj>sqllocaldb start MSSQLLocalDB LocalDB instance "MSSQLLocalDB" started.
Each parameter in the deserialization constructor on type 'cieb_AXReportPrintDLG.ReportParamComboValues' must bind to an object property or field on deserialization. Each parameter name must match with a property or field on the object. Fields are only considered when 'JsonSerializerOptions.IncludeFields' is enabled. The match can be case-insensitive.All fields looks like OK. The problem is in the parameter names in the constructor. This version returns error:
public class ReportParamComboValues {
/* description - for text */
public string Description { get; set; }
/* returned value for SSRS report param */
public string Value { get; set; }
public ReportParamComboValues( string _description, string _value ) {
this.Description = _description;
this.Value = _value;
}
}
This is working:
public class ReportParamComboValues {
/* description - for text */
public string Description { get; set; }
/* returned value for SSRS report param */
public string Value { get; set; }
public ReportParamComboValues( string Description, string Value ) {
this.Description = Description;
this.Value = Value;
}
}
DateTime dt = DateTime.Now; MessageBox.Show( dt.ToString( "yyyy/MM/dd", CultureInfo.GetCultureInfo( "de-DE" ) ) );Output:
2025.09.29The solution is to change the Culture:
DateTime dt = DateTime.Now; MessageBox.Show( dt.ToString( "yyyy/MM/dd", CultureInfo.GetCultureInfo( "en-US" ) ) );Output:
2025/09/29
SUBSTRING( a.PackingSlipId, 1, CHARINDEX('-', a.PackingSlipId ) - 1 ) as document,
..you can get this error, even in a situation when CHARINDEX() returns valid values:
Output:
Msg 537, Level 16, State 3, Line 1 Invalid length parameter passed to the LEFT or SUBSTRING function.The solution is to use NULLIF() function:
SUBSTRING( a.PackingSlipId, 1, nullif( CHARINDEX('-', a.PackingSlipId ), 0 ) -1 ) as document,
/* types for printing type combobox */
public enum PrintingTypeEnum
{
[Description( "On screen" ) ]
TO_SCREEN,
[Description( "On printer" ) ]
TO_PRINT
}
Fill the combobox with items:
CPrintingType.Items.Clear();
foreach ( PrintingTypeEnum item in Enum.GetValues( typeof( PrintingTypeEnum ) ) )
{
string description = GetEnumDescription( item );
CPrintingType.Items.Add( description );
/* -- default value */
if ( item == PrintingTypeEnum.TO_PRINT )
{
CPrintingType.SelectedIndex = CPrintingType.Items.Count - 1;
}
}
private string GetEnumDescription( Enum _value )
{
FieldInfo field = _value.GetType().GetField( _value.ToString() );
DescriptionAttribute attribute = field?.GetCustomAttribute<DescriptionAttribute>();
return attribute == null ? _value.ToString() : attribute.Description;
}
Output:
ALTER PROCEDURE [dbo].[TEST] -- Add the parameters for the stored procedure here ( @Param1 int, @Message varchar(50) output ) AS BEGIN set @Message = 'xxx'; return '-1'; ENDFor calling it use this code:
var param1 = new SqlParameter( "Param1", System.Data.SqlDbType.Int ); param1.Direction = System.Data.ParameterDirection.Input; param1.Value = iYear; var message = new SqlParameter( "Message", System.Data.SqlDbType.VarChar, 50 ); message.Direction = System.Data.ParameterDirection.InputOutput; message.Value = ""; var ret = context.Database.ExecuteSqlRaw( "EXEC TEST @Param1 = @param1, @Message = @message OUTPUT", param1, message ); MessageBox.Show( message.Value.ToString() ); MessageBox.Show( ret.ToString() );
dotnet ef dbcontext scaffold "Server=(LocalDB)\MSSQLLocalDB; AttachDbFilename=C:\_projects\vs\FioTax\FioTax\db.mdf; Integrated Security=True;Connect Timeout=30" Microsoft.EntityFrameworkCore.SqlServer --output-dir Models --context AppDbContext --force
sqlcmd -S localhost\sqlexpress -d username -U sa -P password -h -1 -m 1 -i "c:\dir\command.sql" -o "c:\dir\output\output.txt"
boolean bManualRunning = (BatchHeader::isExecutingInBatch() == false );