08-27-2012 11:26 AM
Hi. I have read the documentation about the actreader account for connecting to an ACT database. I ran the actreader.exe utility and created a password for this account as per the instructions. I was then able to create a connection string which uses the actreader account. Everything seems to be working except that I get no results back. In Visual Studio, I can run the same query and get data returned. I'm wondering if perhaps I am not using the correct syntax for the SQL. Are the table and column names different when using the actreader account?
Below is the code I have. I'm not getting any errors, just no results are being returned. If anyone can point me in the right direction for using the actreader account to retrieve data via an OLEDB connection, it would be greatly appreciated.
Dim conACT As New OleDbConnection
Dim comACT As New OleDbCommand
Dim dsAct As New DataSet
Dim daAct As New OleDbDataAdapter
'* Configure connection object
conACT.ConnectionString = "Provider=SQLOLEDB;Data Source=289614-APP1\ACT7;User ID=actreader;Password=xxxxxx;Initial Catalog=SchillerGroundsCareDev"
'* Configure command object
comACT.Connection = conACT
comACT.CommandType = CommandType.Text
comACT.CommandText = "SELECT NAME FROM TBL_COMPANY ORDER BY NAME"
'* Configure data adapter
daAct.SelectCommand = comACT
'* Open the connection
'* Execute the SQL and fill a dataset table with query results
'* Bind query results to combo box
dataGrid1.DataSource = dsAct.Tables("Companies")
'* Close the connection
08-27-2012 11:33 AM
The ActReader account is used to gain access to an ODBC connection, not OLEDB.
You can connect to the OLEDBv2 Reporting Provider like so:
OleDbConnection connection = new OleDbConnection(ActApp.ActFramework.CurrentACTOLEDB2);
This will connect to the provider as the currently logged in user and respect the security of the said user.
08-28-2012 07:55 AM
Also, the OLEDB connection uses the views, not the tables. So your query would be Select Name from Company order by Name.
Or, use an ODBC connection for ActReader and your query will be correct.