-
AS400 Help
Hi all,
I've just started my new job, and the main database they're running here is an AS400. I'm familiar with using SQL etc, but I've never encountered an AS400 before. . .
I need to get my site (Using ASP/VB.NET) to connect to this database.
Does anyone know how this is done, or alternatively does anyone know of a good site for .NET and AS400 help?
I've been trawling Google for the last 2 hours, and the novelty is starting to wear off. . .
Many thanks in advance,
Highlander
-
Never mind, I've figured it out.
In case anyone would like to know, as I spent hours searching for how to do this:
I set up a system DSN on my web server, pointing to the AS400 machine.
Then in my VB code behind page import the following namespaces:
System.Data.Odbc
System.Data.Odbc.OdbcDataReader
'Then used the following to set up my connection and execute the data reader:
Dim ConnString As String = "dsn=WEBSERVERDSNNAME;uid=AS400USERNAME;pwd=AS400P ASSWORD;"
Dim mySelectQuery As String = "WHATEVER MY SELECT QUERY NEEDS TO BE"
Dim myConnection As New OdbcConnection(ConnString)
Dim myCommand As New OdbcCommand(mySelectQuery, myConnection)
myConnection.Open()
Dim myReader As OdbcDataReader
'I bound this to a datalist, but you can do whatever you want with the data from here.
myReader = myCommand.ExecuteReader()
Me.DataList1.DataSource = myReader
Me.DataList1.DataBind()
' Close the connection.
myConnection.Close()
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
|