Newbies Raja Posted April 15, 2005 Newbies Posted April 15, 2005 I had written an ODBC connector to FM Pro using VB.NET application, where I get data via following two lines that work just fine. connection.Open("Provider=MSDASQL.1;Data Source=FMTest;User ID=sa;Password=sa;") recordset.Open("Select * from PMProTest.fp7", connection) where, connection and recordset are initialized as follows: Dim connection As ADODB.Connection = new ADODB.Connection Dim recordset As ADODB.Recordset = new ADODB.RecordSet However, writing a similar application using C# is failing with exception System.Data.Odbc.OdbcException: [iM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified The C# code looks like this: // Note: all Odbc* classes are from System.Data.Odbc namespace. m_Command = new OdbcCommand(); m_Connection = OdbcConnection("Provider=MSDASQL.1;Data Source=FMTest;User ID=sa;Password=sa;")"); m_Connection.Open(); m_Command.Connection = m_Connection; ...... ...... m_Command.CommandText = "Select * from PMProTest.fp7"; m_DataReader = m_Command.ExecuteReader(CommandBehavior.Default); ...... ...... Anyway, the exception is thrown at call to m_Connection.Open() . Anybody has any idea what I am doing wrong? Only difference between the two application is that I am using ADODB (version 2.8) control in VB and included System.Data.Odbc reference and namesspace in c# solution and code. Thanks, Raja.
Recommended Posts
This topic is 7164 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now