Another article about net connection to Informix Database

Source: Internet
Author: User
Tags informix net command
Original article:

Http://www-1.ibm.com/support/docview.wss? Uid = swg21192027

Microsoft Visual Studio. net c # code example that opens a connection to a IBM Informix database using the IBM Informix. net provider.

Problem
This document provides a Microsoft Visual Studio. net c # code example that opens a connection to a IBM Informix database using the IBM Informix. net provider.
 
 
Solution

Introduction

This document provides a Microsoft Visual Studio. net c # code example that opens a connection to a IBM Informix database using the IBM Informix. net provider.

Before you begin

This document assumes you have Microsoft Visual Studio. NET or Microsoft Visual Studio. NET 2003 installed. It also assumes you have IBM Informix Client SDK 2.81.tc3 or greater installed.

The IBM Informix. net provider uses the setnet32.exe registry values to resolve connection information. This document assumes you have entered you informixserver connection information using setnet32.exe

    Steps

    1. copy file class1.cs.txt to working directory and rename to class1.cs:

    2. Edit class1.cs and modify the connstring value as noted in the code comments.

    3. Open a Visual Studio. NET Command Prompt window click


      Start --> programs --> Microsoft Visual Studio. NET --> Visual Studio. NET tools --> Visual Studio. NET Command Prompt

    4. Set informixdir equal to the path of you IBM Informix Client install directory.


      > Set informixdir = C:/sdk281/bin

    5. Add informidir/bin to your path.


      > Set Path = % informixdir %/bin; % PATH %

    6. Compile class1.cs.


      > CSC/R: % informixdir %/bin/IBM. Data. Informix. dll class1.cs

    7. Run class1.exe.


      > Class1.exe

          Using: Server = ol_strongright; database = stores_demo; uid = caryw; password #####
          Success!

      Common Problems

        Symptom:Compile error: Error cs0006: Metadata File 'ibm. Data. Informix. dll 'could not be found

        > CSC/R: IBM. Data. Informix. dll class1.cs
        Microsoft (r) Visual C #. Net compiler version 7.10.3052.4
        For Microsoft (R). Net Framework Version 1.1.4322
        Copyright (c) Microsoft Corporation 2001-2002. All rights reserved.

        Error cs0006: Metadata File 'ibm. Data. Informix. dll 'could not be found

        Resolution:Specify path to IBM. Data. Informix. dll
        > CSC/R:% Informixdir %/Bin/IBM. Data. Informix. dll class1.cs

        Symptom:Unhandled exception at runtime
        > Class1.exe

        Unhandled exception: system. Io. filenotfoundexception: file or assembly name IBM.
        Data. Informix, or one of its dependencies, was not found.
        File Name: "IBM. Data. Informix"

        Resolution:IBM. data. informix driver does not exist in GAC (Global Assembly Cache ). see the document 'installing. net provider 'Listed in the related URL section of this page for information on resolving this driver problem.

         

        Contact Us

        The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

        If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

        A Free Trial That Lets You Build Big!

        Start building with 50+ products and up to 12 months usage for Elastic Compute Service

        • Sales Support

          1 on 1 presale consultation

        • After-Sales Support

          24/7 Technical Support 6 Free Tickets per Quarter Faster Response

        • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.