|
-
Jan 4th, 2005, 11:29 AM
#1
Thread Starter
Lively Member
DSN Problem w/ ASP.NET
I am trying to connect to an IBM AS/400 Database. I have created a system DSN called "SR". I am using the following code:
VB Code:
Dim cnItemConn As New Odbc.OdbcConnection
Dim daItemAdapter As New Odbc.OdbcDataAdapter
Dim dsItemSet As New DataSet
Dim cmdselect As New Odbc.OdbcCommand
Dim sCmd As String
cnItemConn.ConnectionString = "DSN=SR;uid=xxxx;pwd=yyyyy;Driver={Client Access ODBC Driver (32-bit)}"
dsItemSet.Tables.Add("Items")
sCmd = "SELECT IASA.ITNBR, IBL.MOHTQ, IASA.WHSLC, IASA.ITDSC FROM AMFLIBX.ITEMBL AS IBL LEFT OUTER JOIN AMFLIBX.ITEMASA AS IASA ON IBL.ITNBR=IASA.ITNBR WHERE IASA.ITNBR ='90503'"
cmdselect.Connection = cnItemConn
cmdselect.CommandText = sCmd
daItemAdapter.SelectCommand = cmdselect
daItemAdapter.Fill(dsItemSet.Tables("Items"))
When I run this code in an ASP.NET Web App I get an error, "Data Source Name not found and no default driver specified." The exact same code in a VB.NET Windows application, running on the same PC hosting the Web App, works fine. Any ideas?
Joe Cody
Data Integration Engineer
Novaspect, Inc.
Elk Grove Village, IL
-
Jan 4th, 2005, 02:20 PM
#2
Frenzied Member
Re: DSN Problem w/ ASP.NET
You should try to connect without the DSN if you can. Meaning use a fully Connection String based Connection. Also is there a DataSource configured on the Web Server? That's where it has to be for a Web Based app.
I haven't worked with an AS/400 in 4 or 5 years and I had problems then because we didn't have the correct drivers on our server(Web Server). You also might want to look into the cause being related ASPNET user name and that ASP.Net Try to connect with this.
Sorry I can't be more helpfull. Are you working with DB2?
Magiaus
If I helped give me some points.
-
Jan 4th, 2005, 02:24 PM
#3
Thread Starter
Lively Member
Re: DSN Problem w/ ASP.NET
I tried both DSN and DSN-less connections to no avail. The desktop machine is the web server so permissions and drivers shouldn't be an issue. I managed to get the app working using OLE, but I would still like to resolve the ODBC issue for future reference...
Joe Cody
Data Integration Engineer
Novaspect, Inc.
Elk Grove Village, IL
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|