cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to connect SAP Hana database using C#

makhamadzoidov
Explorer
0 Likes
4,327

Hello 

I need to connect SAP hana database using C# but I can't do it. I wrote python it connect successfully but in C# I can't do it.

Here this is python code. This code works good. I need to connect to server using my own local computer. (I don't have sap b1 app and sap hana app in my computer). Please write C# code to connect sap hana from local computer using C#.

import warnings
from hdbcli import dbapi

warnings.filterwarnings("ignore")

sap_db = "DATABASE_NAME"
address = "SERVER_IP_ADDRESS"
conn = None

try:
conn = dbapi.connect(
address=address,
port='PORT',
user='SYSTEM',
password='PWD',
)
# If no errors, print connected
print('connected')

# conn.close()
except Exception as e:
conn.close()
print(str(e))
sys.exit('Query failed......')

Accepted Solutions (1)

Accepted Solutions (1)

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert

Hi makhamadzoidov,

Kindly refer to the following post: Creating a C# Application Using SAP HANA and ADO.NET 

Hope it helps!

Kind regards,

ANKIT CHAUHAN

SAP Business One Support

Answers (0)