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 #?
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 #?
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();