I am working against a Informix DB from C# ASP .Internet 4. with an ODBC connection. This database does change frequently and so i read out what DBs which are installed in the sysmaster table.

Based on choice my user makes I have to setup a ODBC link with the choosen DB or alter the current link with vary from the systmaster DB towards the one choosen.

Anybody got any idea how to get this done? I suspect it should be easy to setup a brief ODBC connection. Also in Visual Studio underneath the qualities for my ODBC connection I actually do possess a connection string searching such as this:


I've looked around for any library for connecting directly with no ODBC to informix however with now success.

Thanks, Stefan

I guess you can wreck havoc on the registry directly, but you might call odbcconf.exe, the industry standard Home windows utility. Here's an MSDN link

When I had been considering how you can manipulate ODBC connections, Used to do something similar to the next to include an association:

odbcconf.exe /a {CONFIGSYSDSN "SQL Server" "DSN=?|Description=?|SERVER=?(local)|Trusted_Connection=no|Database=?"}

Obviously, you'd replace the ? with your personal parameters.

I've exercised a functional solution that's quite nice. I didn't understand .Internet had full support to get this done from code behind without really modifying the ODBC configurations.

    const string sConnString = "Driver=Informix;uid=user;pwd=password;database=x10stg01_1312;host=;srvr=testdb1;serv=3000;pro=onsoctcp;cloc=en_US.819;dloc=en_US.819;vmb=0;curb=0;scur=0;icur=0;oac=1;optofc=0;rkc=0;odtyp=0;ddfp=0;dnl=0;rcwc=0";
    var oOdbcConnection = new System.Data.Odbc.OdbcConnection(sConnString);

    string queryString =
        "SELECT * FROM tevoc WHERE ev_oc_id=6599098";
    OdbcCommand command = new OdbcCommand(queryString);

    command.Connection = oOdbcConnection;
    OdbcDataReader odbcDataReader = command.ExecuteReader();

    while (odbcDataReader.Read())
        CheckDiv.InnerHtml += "Result: " + odbcDataReader.GetString(6) + "<br/>";

I suppose you need to setup a functional ODBC connection one prior to trying the code behind to just make sure the motive force could be situated ok or at best try looking in their email list of accessible ODBC motorists.