[Mono-list] can't connect to Sybase SQL Anywhere 10

aldwin aldwinaldwin at hotmail.com
Mon Mar 30 10:53:52 EDT 2009


Maybe this code can help you further ...  You don't need to create the ODBC
in your control panel ... but it could help you to get the correct 
values... I'm waiting for Sybase Adaptive Server Anyway implementation in a
new Mono version  (http://www.mono-project.com/Sybase#Action_plan)

using System;
using System.Data;
using System.Data.Odbc;

    IDbConnection dbcon;
    IDbCommand dbcmd;
    IDataReader myReader;

    odbcDsn="DRIVER={SQL Anywhere
10};CommLinks=tcpip(host="+dbIp+";serverport="+dbPort+";dobroadcast=no);ServerName="+dbServer+";DatabaseName="+dbName+";uid="+dbUser+";pwd="+dbPwd+";";

      dbcon = new OdbcConnection(odbcDsn);
      try {dbcon.Open();} catch (Exception e) {ERR+="*SYB001"+e;}  
      dbcmd = dbcon.CreateCommand();

      sql="select name from customer";    
      dbcmd.CommandText = sql;

      while(myReader.Read()) {
        write myReader["name"].ToString();
      } //end while
      myReader.Close(); }

      dbcmd.Dispose();
      dbcon.Close();

-- 
View this message in context: http://www.nabble.com/can%27t-connect-to-Sybase-SQL-Anywhere-10-tp22128198p22785070.html
Sent from the Mono - General mailing list archive at Nabble.com.



More information about the Mono-list mailing list