mibuso.com

Microsoft Business Solutions online community
It is currently Sun May 26, 2013 5:23 am

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Getting company info
PostPosted: Wed Jul 04, 2007 8:37 pm 
Offline

Joined: Wed Jul 04, 2007 8:16 pm
Posts: 2
Location: Montreal QC
Country: Canada (ca)
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


Top
 Profile E-mail  
 
 Post subject: Getting company info
PostPosted: Fri Jul 06, 2007 10:51 pm 
Offline

Joined: Wed Jul 04, 2007 8:16 pm
Posts: 2
Location: Montreal QC
Country: Canada (ca)
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


Top
 Profile E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum


Search for:
Jump to: