<%@ LANGUAGE="VBSCRIPT" %>
<%
Dim objCon
Dim objRS
Dim str_DSN
Dim strSQL
Dim objCmd
Dim myArray
str_DSN = "filedsn=live.dsn"
myArray = ""

Set objCon = Server.CreateObject("ADODB.Connection")
With objCon
    .ConnectionString = str_DSN
    .CursorLocation = 3 'adUseClient Cursor
    .Open
End With


myString = trim(Request.Form("SalesPart"))
myArray=Split(myString,",")

For i = LBound(myArray) TO UBound(myArray)
    'Response.Write myArray(i) & "<BR />"
Next

strSQL = " SELECT I.PART_NO, I.DESCRIPTION, P.COST_SET, P.DIRECT_ACCUM_COST, P.INDIRECT_ACCUM_COST, P.TOTAL_ACCUM_COST, I.PART_STATUS, P.PART_NO "
strSQL = strSQL & " FROM   IFSAPP.INVENTORY_PART I, IFSAPP.PART_COST P "
strSQL = strSQL & "WHERE I.PART_NO = P.PART_NO and I.PART_NO in ('" & myString & "') AND P.COST_SET='1' "
'Response.Write strSQL

Set objCmd = Server.CreateObject("ADODB.Command")

With objCmd
    Set .ActiveConnection = objCon
    .CommandText = strSQL
    .CommandType = &H0001 ' adCmdText
End With

Set objRS = Server.CreateObject("ADODB.Recordset")

With objRS
    .CursorType = 3 'adOpenStatic
    .LockType = 1 ' adLockReadOnly
End With

'' Check the results
Set objRS.Source = objCmd
objRS.Open
myArray = ""
Do While Not objRS.EOF

    myArray = myArray + "<tr><td>" & objRS.Fields(0).Value & "</td><td>" & objRS.Fields(1).Value & "</td>" & _
          "<td>" & objRS.Fields(2).Value & "</td><td>" & objRS.Fields(3).Value & "</td><td>" & objRS.Fields(4).Value &"</td><td>" & objRS.Fields(5).Value &_
          "</td><td>" & objRS.Fields(6).Value &"</td></tr>"

    objRS.MoveNext
Loop



objRS.Close
Set objRS = Nothing
Set objCmd = Nothing
Set objCon = Nothing

%>

<html>
<head>
<style type="text/css">
<!--
.p {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
}
.pB {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    font-weight: bold;
}
.pBB {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 16px;
    font-weight: bold;
}
-->
</style>
</head>
<body style="font-family:verdana;font-size:10pt;" >
<p class=pBB>
Sales Part Number: <%=myString%></p>
<hr>
<table class=p width="200%" border="0" ID="Table1">
    <tr>
    <td class=pB>Part No</td>
    <td class=pB>Description</td>
    <td class=pB>Status</td>
    <td class=pB>Reason</td>
    <td class=pB>Sales Price Group</td>
    <td class=pB>Sales Price</td>
    <td class=pB>Create SM Object</td>
    <td class=pB>Warranty</td>
    <td class=pB>No Days Warranty</td>
    <td class=pB>Include in Quote Tool</td>
    <td class=pB>Non-Discountable Part</td>
    <td class=pB>Est. Material Cost</td>
    <td class=pB>Est. Labor</td>
    <td class=pB>Estimated Cost</td>
    <td class=pB>Margin</td>
    <td class=pB>Price</td>
    <td class=pB>Long Description</td>
    <td class=pB>Sales Part No.</td>
    <td class=pB>Comment</td>
    </tr>
  <%if myString <> "" then %>
  <%=myArray%>
  <%else %><tr><td colspan=4>None</td></tr>
  <%end if%>
</table>
</body>
</html>

Recommended Answers

All 4 Replies

boss.. whts ur problem.. Explain it before giving the source code..

in this code the user is to input a part number such as 99999-4170 and the information will split to display information on one line about each part, but in the where statement i am only able to get one part number to display if user types in more than one part number

which database u r using..

ORACLE

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.