1

Hi can any one please advise me, how to connect Navision using ASP.NET. This is the connection string I have set in Web.Config

<connectionStrings>
<add name="Navision" connectionString="dsn=TEST;uid=user1;pwd=paswd;database=Test;CompanyName=HHT Test;" />
</connectionStrings>

But when I am trying to connect, I am getting this error:

System.Data.Odbc.OdbcException: ERROR [S1000] [Simba][SimbaEngine ODBC Driver]
[DRM File Library] The operating system returned the error (183):Cannot create 
a file when that file already exists.

Error: 183
ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed
ERROR [01S00] [Simba][SimbaEngine ODBC Driver]Invalid connection string attribute.
ERROR [01000] [Microsoft][ODBC Driver Manager] The driver doesn't support the
version of ODBC behavior that the application requested (see SQLSetEnvAttr).
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, 
Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, 
DbConnectionPoolGroup poolGroup)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, 
DbConnectionFactory connectionFactory)
at System.Data.Odbc.OdbcConnection.Open()
at Service.Getdataset(String SqlStr)

I am using Navision 4.0 SP3 and same ODBC driver.

Rakesh
  • 2,730
  • 10
  • 39
  • 65

2 Answers2

1

ERROR [01S00] [Simba][SimbaEngine ODBC Driver]Invalid connection string attribute. prob means that you cant use CompanyName thing in connection string. ODBC driver simply not aware of what company in Navision means (none of drivers are aware tbh ;)).

You must manually handle interactions with different companies if you sure you want to use ODBC to access Nav.

And one more thing. The way you do now, you only connecting to SQL Server, not to Nav (it is different things). So if it is your goal then use System.Data.SqlClient.

If you want to connect to Nav with all its business logic and etc. then you need to use other integration options. Such as files exchange, tcp listener, MSMQ and so on. Not saying about web services.

Mak Sim
  • 2,148
  • 19
  • 30
  • "ERROR [01S00] [Simba][SimbaEngine ODBC Driver]Invalid connection string attribute." - is not the error I am getting.. – Rakesh Sep 11 '13 at 08:34
  • Anyway it is in the stacktrace and the rest I said is true. No driver can work with Nav companies natively. – Mak Sim Sep 11 '13 at 12:12
  • But removing that doesn't resolved my problem ..any other changes needed ..? – Rakesh Sep 11 '13 at 12:47
  • Any reasons you cant use SqlClient or other options? – Mak Sim Sep 12 '13 at 07:24
  • The Navision is using my company's client not me. so I can use Navision only. – Rakesh Sep 12 '13 at 10:09
  • SqlClient is .NET feature to connect to SQL Server. You can use it to connect to server instead of ODBC. If your client not using nativ database. Then it just sucks... – Mak Sim Sep 13 '13 at 07:14
  • I am already using ODBC only .. there is any chance to make it work..? – Rakesh Sep 13 '13 at 07:27
  • I cant help you with ODBC. It looks like third-party driver problem. And its quite old so hard to find answer. – Mak Sim Sep 13 '13 at 10:25
-1

The problem is with the company name. In my opinion of course. When I was connecting nav with Windows Phone application via REST, I have been using Odata and here is one example how company name looks like:

"http://addres/OData/Company('CRONUS%20%C3%86%C3%98%C3%85%20Company')/"

RredCat
  • 5,259
  • 5
  • 60
  • 100