Solved

Opening a connection to a delimited text file

Posted on 1998-11-16
3
187 Views
Last Modified: 2013-12-25
I am creating a form that figures out shipping costs based on where the I am shipping from, the destination shipping location, the shipping method, and the weight. I am keeping this information in a text file that is connected to only when the form results page is accessed. I've seen numberous examples for Access and SQL Server how to do this but not for a text file. Once I open it, how do I get a row of data from it to compare it to the values (see case statement)

Below is my Formresults code:

<%@ Language=VBScript %>
<html>

<head>
<meta NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<title></title>
</head>

<body>
<% dim v_get_cost
dim v_total_cost
dim v_from_location
dim v_to_location
dim v_weight
dim v_shipping_type

v_from_location = Request.form("from_location")
v_to_location = Request.Form("to_location")
v_weight = Request.Form("weight")
v_shipping_type = Request.Form("shipping_type")

Select Case v_shipping_type
Case "LTL"
      v_get_cost = (select LTL_cost from testdata.txt where from_location = v_from_location and to_location = v_to_location and v_weight between min_weight and max_weight;)
      v_total_cost = v_weight * v_get_cost
Case "AIR"
      v_get_cost = (select AIR_cost from testdata.txt where from_location = v_from_location and to_location = v_to_location and v_weight between min_weight and max_weight;)
      v_total_cost = v_weight * v_get_cost
Case "TL"
      v_get_cost = (select TL_cost from testdata.txt where from_location = v_from_location and to_location = v_to_location and v_weight between min_weight and max_weight;)
      v_total_cost = v_get_cost
End Select
%>

<p>You have chosen to ship from <%=v_from_location%> to <%=v_to_location%>.<br>
The weight of the shipment is <%=v_weight%><br>
The desired shipping method is <%=v_shipping_type%><br>
<br>
The total cost of shipping is <%=v_total_cost%><br>
</p>

<p>process another shipping cost</p>
</body>
</html>


Here's the text file:

From_location,To_location,Min_Weight,Max_Weight,LTL,AIR,TL
MI,AZ,0,99,0.43,0.8,3246
MI,AZ,100,199,0.18,0.75,3246
MI,FL,0,99,0.32,0.8,1818

Any help you can give would be appreciated...
0
Comment
Question by:aguldber
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 

Author Comment

by:aguldber
ID: 1856406
Edited text of question
0
 
LVL 1

Accepted Solution

by:
rajgn earned 70 total points
ID: 1856407
You cannot Query a TEXT file as you do with any database. But the task you're looking for can be accomplished using a text file also(but is labourious). In this case you need to store data in Text file in a specific format(with suitable delimiters), and have to retrieve the data from it based on the format you're storing. For this you need to use TextStream object and FileFileSystemObjects.
0
 

Author Comment

by:aguldber
ID: 1856408
Sorry it's taken so long for me to grade, I thought I did it when I first read you answer
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Get to know the ins and outs of building a web-based ERP system for your enterprise. Development timeline, technology, and costs outlined.
There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

710 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