Solved

Connection string conversion

Posted on 2013-06-07
2
1,529 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

707 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now