If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > Connecting Informix from VS2008 and .NET provider

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-03-09, 12:09
omdc omdc is offline
Registered User
 
Join Date: Nov 2009
Posts: 1
Red face Connecting Informix from VS2008 and .NET provider

Hello.

I´m new to Informix
I´m getting some problems connecting to Iformix database.
I already install DB2 Client v9.5. This installs IBM.Data.Informix.dll 9.5.0.1.

When a try to connect my connection string give a Invalid Argument error.
my code:

Code:
private void btConnect_Click(object sender, EventArgs e)
        {
            

        

            
           string constr = "Host=" + "abutre" + "; " +
                    "Service=" + "abutre_uci_tcp" + "; " +
                    "Server=" + "abutre_uci_tcp" + "; " +
                    "Database=" + "uci2" + "; " +
                    "Uid=" + "uci" + "; " +
                    "Protocol= " + "onsoctcp" + ";" +
                    "Password=" + "uci" + "; " +
                    "Client_Locale=" + "en_US.CP1252" + ";" + 
                    "DB_Locale=" + "en_US.819" + ";";
                    "Persist Security Info=" + "True" + ";" +
                    "Authentication=" + "Server" + ";";

            IfxConnection conn = new IfxConnection();
            
            try
            {

                conn.ConnectionString = constr;
                conn.Open();

                IfxCommand iCommand = new IfxCommand();
                iCommand.CommandText = "select * from tmp_teste_informix";
                IfxDataAdapter iDataAdapter = new IfxDataAdapter(iCommand.CommandText, conn);
                iDataAdapter.Fill(ds);
                dataGridView1.DataSource = ds.Tables[0];
                MessageBox.Show("connection Sucessfull!");

            }
            catch (Exception ex)
            {
                MessageBox.Show("Problem with connection attempt: " + ex.Message);
            }

}
I already view connection string in ConnectionStrings.com - Forgot that connection string? Get it here!

help meeee
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On