Differences

This shows you the differences between two versions of the page.

Link to this comparison view

dev:odbc:sample_net [2015/01/28 01:50]
doc created
dev:odbc:sample_net [2016/06/28 22:38]
Line 1: Line 1:
-{{page>:​top_add&​nofooter&​noeditbtn}} 
- 
-====== Development:​ ODBC Interface ====== 
- 
-[[dev:​odbc:​home|Overview]] | [[dev:​odbc:​datasources|ODBC Datasources]] | [[dev:​odbc:​sample_c|Sample C# Program]] | **[[dev:​odbc:​sample_net|Sample .NET Program]]** 
- 
----- 
- 
- 
-===== Sample C#  Program ===== 
- 
-The following is a very simple C# program that shows a basic connection to an Omnidex Environment and simple query processing. 
- 
-<code csharp> 
-using System; 
-using System.Collections.Generic;​ 
-using System.Text;​ 
-using System.Data.Odbc;​ 
- 
-namespace OdxODBCSample 
-{ 
-  class OdxODBCSample 
-  { 
-    static void Main(string[] args) 
-    { 
-      Console.WriteLine("​Omnidex Sample C# Program"​);​ 
- 
-      string connString =  
-             ​@"​DRIVER={Omnidex};​CONNECTIONSTRING=[server1:​7555]c:​\class\simple.xml";​ 
-      string sqlselect = @"​select NAME, PHONE from INDIVIDUALS";​ 
-      OdbcConnection conn = null; 
-      OdbcDataReader reader = null; 
-      try 
-      { 
-        // Open Connection 
-        conn = new OdbcConnection(connString);​ 
-        conn.Open();​ 
-        // Execute the SQL statement 
-        OdbcCommand cmd = new OdbcCommand(sqlselect,​ conn); 
-        reader = cmd.ExecuteReader();​ 
-        // Display output header 
-        Console.WriteLine("​NAME\tPHONE\n"​);​ 
-        // Process the result set 
-        while (reader.Read()) 
-        { 
-          Console.WriteLine( 
-              "​{0}\t{1}",​ 
-              reader.GetString(0),​ 
-              reader.GetString(1) 
-          ); 
-        } 
-      } // try 
-      catch (Exception e) 
-      { 
-        Console.WriteLine("​Sql Error: " + e); 
-      } 
-      finally 
-      { 
-        try 
-        { 
-          if (reader != null) 
-            reader.Close();​ 
-          if (conn != null) 
-            conn.Close();​ 
-        } 
-        catch (Exception e) 
-        { 
-          Console.WriteLine("​Close Error: " + e); 
-        } 
-      } 
-    } 
-  } 
-} 
-</​code>​ 
- 
-=====  ===== 
- 
-**[[dev:​odbc:​datasources|Prev]]** 
- 
-====== Additional Resources ====== 
- 
-See also:  
- 
-{{page>:​dev:​see_also&​nofooter&​noeditbtn}} 
- 
-{{page>:​bottom_add&​nofooter&​noeditbtn}} 
  
 
Back to top
dev/odbc/sample_net.txt ยท Last modified: 2016/06/28 22:38 (external edit)