Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Opening a connection to a delimited text file

Posted on 1998-11-16
3
Medium Priority
?
189 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 280 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

Quick Start: DOCKER

Sometimes you just need a Quick Start on a topic in order to begin using it.. this is just what you need to know to get up and running with Docker!

Question has a verified solution.

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

Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.
Suggested Courses

730 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