Sybase database connection with C #

-1

I have a Sybase database file on my machine, I want to make this database available in my C # application, how do I make this Sybase database file available, and how do I access that database with C #?

    
asked by anonymous 17.07.2018 / 22:27

1 answer

1

With the SQL Anywhere .NET Data Provider

You can download it through Nuget and there are two versions:

For ASA16: iAnywhere.Data.SQLAnywhere.v4 .5

For ASA2017: Sap.Data.SQLAnywhere

Example:

SAConnection conn = new SAConnection("Data Source=SQL Anywhere 12 Demo");
conn.Open();
SACommand cmd = new SACommand("SELECT Surname FROM Employees", conn);
SADataReader reader = cmd.ExecuteReader();
listEmployees.BeginUpdate();
while (reader.Read())
{
    listEmployees.Items.Add(reader.GetString(0));
}
listEmployees.EndUpdate();
reader.Close();
conn.Close();
    
17.07.2018 / 22:51