zw wrote:
On Feb 5, 5:07 pm, Göran Andersson <g...@guffa.comwrote:
>You can use the classes in System.Data.Odbc to connect using ODBC.
Can someone include a sample code using System.Data.Odbc with TimesTen
DB ?
Oracle told me that TimesTen doesn't have support for this.
What's the workaround if C# has to be used. Any advice ?
..NET supports ODBC.
TimesTen supports ODBC.
The obvious conlcusion is that .NET can use TimesTen via ODBC.
There are no tricks necessary !
Code example:
using System;
using System.Data.Odbc;
public class MainClass
{
public static void Main(string[] args)
{
OdbcConnection con = new OdbcConnection("Dsn=TestTimesTen;");
con.Open();
OdbcCommand cmd = new OdbcCommand("SELECT * FROM t1", con);
OdbcDataReader rdr = cmd.ExecuteReader();
while(rdr.Read()) {
int f1 = (int)rdr[0];
string f2 = (string)rdr[1];
Console.WriteLine(f1 + " " + f2);
}
con.Close();
}
}
Speak about straightforward code !
Arne