I am trying to establish a connection to a DSN server to pull data from our Cisco Phone System using the Informix Drivers provided in 32bit. I have tried a variety of methods and it seems that the error is happening once I try to connect to the DSN. I have tried with and without the password and username in order to connect to it and have been banging my head against the wall trying to figure this out.
The code is simple and is as follows
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.Odbc;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace RSQ_App_V1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
try
{
OdbcConnection connection = new OdbcConnection();
connection.ConnectionString = "DSN='UCCX";
string queryString = "SELECT totalcalls FROM rtcsqssummary WHERE csqname='RSQ-Spanish' OR csqname='RSQ-English'";
OdbcCommand command = new OdbcCommand(queryString, connection);
MessageBox.Show("IT Breaks after this....");
connection.Open();
MessageBox.Show("You solved the connection issue!");
OdbcDataReader reader = command.ExecuteReader();
textBox1.Text = queryString;
DataTable dt = new DataTable("UCCXData");
dt.Load(reader);
reader.Close();
connection.Close();
//fill the dataview
dvData.DataSource = dt;
////int TotalContactsWaiting = 0;
////ODBC Connection
//OdbcConnection DbConnection = new OdbcConnection("DSN=UCCX");
//string queryString = "SELECT totalcalls from FROM rtcsqssummary WHERE csqname='RSQ-Spanish' OR csqname='RSQ-English'";
//OdbcCommand DbCommand = DbConnection.CreateCommand();
////Open connection
//DbConnection.Open();
////DbCommand.CommandText = "SELECT SUM(totalcalls) AS stotalcalls, SUM(callswaiting) AS scallswaiting, SUM(oldestcontact) AS soldestcontact, SUM(callshandled) AS scallshandled, SUM(callsabandoned) AS scallsabandoned, SUM(longesttalkduration) AS slongesttalkduration FROM rtcsqssummary WHERE csqname='RSQ-Spanish' OR csqname='RSQ-English'";
//OdbcDataReader DbReader = DbCommand.ExecuteReader();
//TotalContactsWaiting = Convert.ToChar("scallswaiting");
//test1.Text = TotalContactsWaiting;
//DbReader.Close();
//DbCommand.Dispose();
//DbConnection.Close();
}
catch (Exception ex)
{
MessageBox.Show("there was an error - " + ex);
}
}
private void Form1_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'dataSet1.rtcsqssummary' table. You can move, or remove it, as needed.
this.rtcsqssummaryTableAdapter.Fill(this.dataSet1.rtcsqssummary);
}
}
}
The error I am getting is as follows:
System.Data.Odbc.OdbcException (0x80131937): ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
at System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle, RetCode retcode)
at System.Data.Odbc.OdbcConnectionHandle..ctor(OdbcConnection connection, OdbcConnectionString constr, OdbcEnvironmentHandle environmentHandle)
at System.Data.Odbc.OdbcConnectionOpen..ctor(OdbcConnection outerConnection, OdbcConnectionString connectionOptions)
at System.Data.Odbc.OdbcConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionInternal.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.Odbc.OdbcConnection.Open()
at RSQ_App_V1.Form1..ctor()
I have tried google and a variety of other methods to try to figure this out and have made no progress on this.
It seems that my issue is connecting to the DSN, once that is established I should be able to move forward from there and pull the data that is needed.
Any help would be greatly appreciated.
Thank you,
Cesar

New Topic/Question
Reply



MultiQuote





|