Solved

Connection string conversion

Posted on 2013-06-07
2
1,556 Views
Last Modified: 2013-06-07
I have a need to connect to an IP21 server and pull data from it and post it to the web. there is currently a VB progrm that runs and pull some data and the connection string that program uses is as follows:
'Dimension the connection string and odbc command.

Dim StrConn As String = "Driver={AspenTech SQLPlus};HOST=" & HostName & ";PORT=10014"

Dim oCmd As New System.Data.Odbc.OdbcCommand

Dim IntegerIndex As Integer

'Create and open the connection to the server.

oCmd.Connection = New System.Data.Odbc.OdbcConnection(StrConn)

oCmd.Connection.Open()

'Execute the SQL command.

oCmd.CommandText = SqlCommand

Open in new window


what i need to do is figure out how to make this connection string work in an ASP webpage. can someone help me with that?
0
Comment
Question by:jlcannon
2 Comments
 
LVL 28

Accepted Solution

by:
omgang earned 500 total points
ID: 39229283
Try in your ASP page

<%
Dim conn, rs

Set conn = Server.CreateObject("ADODB.Connection")
conn.ConnectionString = "Driver={AspenTech SQLPlus};HOST=TheHostName;PORT=10014"

conn.open

set rs=conn.Execute(SqlCommand)

%>

Will you still need to pass the host name dynamically?  If so, You'll need to add to the script a method to obtain the host name into a variable and then use the variable in the connection string assignment just like in the VB program.

OM Gang
0
 

Author Closing Comment

by:jlcannon
ID: 39229319
no need to pass host dynamically since it is a single host and will not change i can just hard code it. Thank you!
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VB6 Compile Compatibility Issue 4 102
Question about ASP Including Files 6 58
RUNRMTCMD from AS/400 12 46
Connection to multiple databases 13 19
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question