Hi guys
Did anyone able to connect to navision using ASP connection strings ?
I used using the DSN but it doesn't work.
For connecting to access i used this code ::
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "c:\Customers.mdb"
set rs = Server.CreateObject("ADODB.recordset")
rs.Open "Select * from Customer", conn
For connecting to navision i tried to use the same code with some modification, but i am not sure what to use for provider. do anyone know what should i use for provider.
0
Comments
However, you might have an easier time creating a system dsn, the connection string is much easier. First create a machine DSN named Navision, then use the following code:
Dim strSQL, strDSN
Dim i
strSQL="Select * from Customer"
strDSN="DSN=Navision"
Set rs=Server.CreateObject("ADODB.Recordset")
rs.Open strSQL,strDSN
Response.Write "<TABLE BORDER=1>"
`Write out Field Names
Response.Write "<TR>"
For i=0 to rs.fields.count-1
Response.Write "<TH>"+rs(i).Name+"</TH>"
Next
Response.Write "</TR>"
`Write out Data
Do while not rs.eof
Response.Write "<TR>
For i=0 to rs.fields.count-1
Response.Write "<TD>
Response.Write rs(i)
Response.Write "</TD>
Next
Response.Write "</TR>
rs.movenext
Loop
Response.Write "</TABLE>"
I didn't test it, but this should work.
Mike
With regard to Mstallmann -
I have been looking for a solution to this problem and found your post.
I tried what you suggested, and got error messages referring to problems with the adovbs.inc file.
Have you had any joy with this? Have you found an alternative way to do it?
If so, please help. ](*,)
What error are you getting? I am assuming that it would have nothing to do with the adovbs.inc file, unless you made changes to it. I think you should be able to run my code without including the adovbs.inc. Try removing the reference to it at the top and see if your code runs.
Mike
I have removed the include (adovbc.inc).
I placed a form on a page with a button. The form's action is the asp page making the connection to the Customer table in Navision.
When the button is clicked, execution moves to the connection page, though it appears blank in the browser.
No error messages, though.
I've just run the connection again, with the following error :
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
/Navision.asp, line 11
strSQL="Select * from Customer"
strDSN="DSN=Navision"
Set rs=Server.CreateObject("ADODB.Recordset")
rs.Open strSQL,strDSN <
Line 11
read more in the codbc documentation on navision cd..
Mike
I have re-installed C/ODBC, created and configured a system DSN and I have made changes to my code.
I have been able to access and display data from Navision.
I have tried some recordset functions with the retrieved data and found that certain recordset properties don't sit well i.e.
Using rs.Open strSQL, ocon, 3, 1 to open a recordset
Then rs.AbsolutePage = var where car is a variable
Results in the following error message :
ADODB.Recordset (0x800A0CB3)
Current Recordset does not support bookmarks. This may be a limitation of the provider or of the selected cursortype.
I have changed CursorType and LockType parameters without change.
But this is a different issue from that we have been discussing.
Thank you all for your responses. =D>
He told me they were planning on making the driver .net compatible with 4.0, but I haven't followed up on that.
Basically, they didn't provide interfaces for much of the MS funcionality in the driver, and it is hit and miss. I think thier plann was just to provide enough for office integration, etc. and were not planning on developers getting down and dirty with it.
Another option is to build you own object that basically takes the recordset provided by the Nav ODBC driver and then create a new recordset, populate it with the data and pass it on to the client application. This is very resource intensive, but it would make the functionality transparent to other developers.
One more option is to try out the OCX. I have not gone that route, but it may be worth a shot.
Mike
dim ADOconn, ADOrs, sqlstr
sqlstr="Select * From Currency"
set ADOconn = Server.CreateObject("ADODB.Connection")
ADOconn.Open "NavisionSystemDSN"
set ADOrs = ADOconn.execute(sqlstr)
if ADOrs.BOF and ADOrs.EOF then ' Query didn't return any records.
Response.Write("No Records.")
else
ADOrs.MoveFirst
Do While Not ADOrs.EOF
Response.Write((ADOrs("Code")) & " " _
& (ADOrs("Last Date Modified")) & "<br>")
ADOrs.MoveNext
Loop
Response.Write("<p>End of data.")
end if
ADOrs.close
set ADOrs = nothing
Hope this helps.
Is here:
http://www.mibuso.com/forum/viewtopic.php?t=8063
Regards
I know that there are a lot of Microsoft freaks in here but ColdFusion is way more rapid when it comes to developing database driven web apps.
Good Luck!