This post will help you if you want to execute non-query on Sybase database in C# like an UPDATE, CREATE, DELETE or others. The idea here is to explore the NuGet package AdoNetCore.AseClient as the connection driver for the database.

For some historical background, as per Wikipedia: “Sybase, Inc. was an enterprise software and services company that produced software to manage and analyze information in relational databases, with facilities located in California and Massachusetts. Sybase was acquired by SAP in 2010; SAP ceased using the Sybase name in 2014. “

Sybase Logo - Run query on Sybase database with C#
Enterprise software for managing relational databases (Wikimedia Commons)

Code for executing non-query command on Sybase in C#

The script uses a hardcoded Connection String that you can specify as you want and explore Application Settings options too. The code execution will create a connection, begin a transaction, prepare the command and execute it. Therefore, in case it succeeds, it commits the command. On the other hand, if it fails, then a rollback will happen.

That’s all for today! In short, I hope this post can help you on creating a simple, but still powerful method that let’s you execute non-query on Sybase database in C#. Now if you need to run queries and select data, you may want to check the post about Run query on Sybase database with C#.

References:
Connection Strings