Getting company info

antoinebaudouinantoinebaudouin Member Posts: 3
edited 2007-07-06 in Dynamics GP
Hi, I need to get the company info that I see when I go to Tools->Setup->Company->Company.

I'm using the eConnect .NET assemblies with GP 9.0 SQL Server2005 and the sample company TWO.

I was able to get Customers, Vendors, Items, Purchase_Order_Transactions, etc with the eConnectRequester method, specifying the DOCTYPE.

I was expecting to find a doctype to get the company data, something like
eConnectOut.DOCTYPE = "Company_Data", but I didn't find it.

eConnect's interface doesn't seem to include a method to execute a SQL query directly such as SELECT * FROM SY01000.
Should I run my query using the data source or should I use something else?

Thank you in advance for any input.
Antoine Baudouin

Comments

  • antoinebaudouinantoinebaudouin Member Posts: 3
    Solved!
    Here's my code. It works fine.

    using System.Data.SqlClient;
    SqlConnection oSqlConnection = new SqlConnection();
    oSqlConnection.ConnectionString =
    "Data Source=" + Configuration.Server +
    ";Initial Catalog=TWO;User=" + DBUserName + ";Password=" + DBPassword;
    oSqlConnection.Open();
    SqlCommand oSqlCommand = oSqlConnection.CreateCommand();
    String sSQL = String.Empty;
    sSQL += "SELECT CMPNYNAM FROM SY01500 ";
    sSQL += "WHERE INTERID = '" + Configuration.CompanyDB + "'";
    oSqlCommand.CommandText = sSQL;
    SqlDataReader oSqlDataReader = oSqlCommand.ExecuteReader();
    oSqlDataReader.Read();
    sCompanyName = oSqlDataReader.GetString(0);

    oSqlConnection = new SqlConnection();
    oSqlConnection.ConnectionString = "Data Source=" + Configuration.Server +
    ";Initial Catalog=TWO;User=" + DBUserName + ";Password=" + DBPassword;
    oSqlConnection.Open();
    oSqlCommand = oSqlConnection.CreateCommand();
    sSQL = String.Empty;
    sSQL += "SELECT CITY, STATE, ZIPCODE, CMPCNTRY FROM SY01500 ";
    sSQL += "WHERE INTERID = '" + Common.Data.Configuration.CompanyDB + "'";
    oSqlCommand.CommandText = sSQL;
    SqlDataReader oSqlDataReader = oSqlCommand.ExecuteReader();
    oSqlDataReader.Read();
    sCity = oSqlDataReader.GetString(0);

    Have a good one!
    Antoine Baudouin
Sign In or Register to comment.