Bem galera... tô eu aqui novamente...
Meus problemas ainda não se esgotaram com o que postei acima, resolvi metade do meu problema...
Porém quanto fui testar a página não percebi o script só funcionava quanto só tem um registro retornando no bd, mas quanto tem mais registros não funciona, agora minha dúvida é será que o problema tá no asp ou no javascript?
Abaixo está o código completo... se algum puder de novo dar uma olhada, eu agradeço muito...
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="../Connections/dbconstru.asp" -->
<%
Dim MM_editAction
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If
' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false
%>
<%
' *** Delete Record: construct a sql delete statement and execute it
If (CStr(Request("MM_delete")) = "form1" And CStr(Request("MM_recordId")) <> "") Then
If (Not MM_abortEdit) Then
' execute the delete
Set MM_editCmd = Server.CreateObject ("ADODB.Command")
MM_editCmd.ActiveConnection = MM_dbconstru_STRING
MM_editCmd.CommandText = "DELETE FROM orcamento WHERE idorcamento = ?"
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 5, 1, -1, Request.Form("MM_recordId")) ' adDouble
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
' append the query string to the redirect URL
Dim MM_editRedirectUrl
MM_editRedirectUrl = "clientes.asp"
If (Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
Response.Redirect(MM_editRedirectUrl)
End If
End If
%>
<%
Dim detalhe__MMColParam
detalhe__MMColParam = "1"
If (Request.QueryString("idcliente") <> "") Then
detalhe__MMColParam = Request.QueryString("idcliente")
End If
%>
<%
Dim detalhe
Dim detalhe_cmd
Dim detalhe_numRows
Set detalhe_cmd = Server.CreateObject ("ADODB.Command")
detalhe_cmd.ActiveConnection = MM_dbconstru_STRING
detalhe_cmd.CommandText = "SELECT orcamento.*, cliente.* FROM orcamento, cliente WHERE idcliente = ? and orcamento.fkcliente = cliente.login"
detalhe_cmd.Prepared = true
detalhe_cmd.Parameters.Append detalhe_cmd.CreateParameter("param1", 200, 1, 50, detalhe__MMColParam) ' adVarChar
Set detalhe = detalhe_cmd.Execute
detalhe_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
detalhe_numRows = detalhe_numRows + Repeat1__numRows
%>
<%
' *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
Dim detalhe_total
Dim detalhe_first
Dim detalhe_last
' set the record count
detalhe_total = detalhe.RecordCount
' set the number of rows displayed on this page
If (detalhe_numRows < 0) Then
detalhe_numRows = detalhe_total
Elseif (detalhe_numRows = 0) Then
detalhe_numRows = 1
End If
' set the first and last displayed record
detalhe_first = 1
detalhe_last = detalhe_first + detalhe_numRows - 1
' if we have the correct record count, check the other stats
If (detalhe_total <> -1) Then
If (detalhe_first > detalhe_total) Then
detalhe_first = detalhe_total
End If
If (detalhe_last > detalhe_total) Then
detalhe_last = detalhe_total
End If
If (detalhe_numRows > detalhe_total) Then
detalhe_numRows = detalhe_total
End If
End If
%>
<%
' *** Recordset Stats: if we don't know the record count, manually count them
If (detalhe_total = -1) Then
' count the total records by iterating through the recordset
detalhe_total=0
While (Not detalhe.EOF)
detalhe_total = detalhe_total + 1
detalhe.MoveNext
Wend
' reset the cursor to the beginning
If (detalhe.CursorType > 0) Then
detalhe.MoveFirst
Else
detalhe.Requery
End If
' set the number of rows displayed on this page
If (detalhe_numRows < 0 Or detalhe_numRows > detalhe_total) Then
detalhe_numRows = detalhe_total
End If
' set the first and last displayed record
detalhe_first = 1
detalhe_last = detalhe_first + detalhe_numRows - 1
If (detalhe_first > detalhe_total) Then
detalhe_first = detalhe_total
End If
If (detalhe_last > detalhe_total) Then
detalhe_last = detalhe_total
End If
End If
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR...nsitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<script language="javascript">
function Calcula(){
var Parametro1=document.frm.valor.value.replace(",",".");;
var Parametro2=document.frm.quantidade.value.replace(",",".");;
var Soma=((parseFloat(Parametro1))*(parseFloat(Parametro2)));
document.frm.total.value=Soma.toFixed(2).replace(".",",");
var Soma=0
}
</script>
<meta
http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link href="../cm.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
body {
background-color: #FFFFCC;
margin-top: 0px;
}
-->
</style></head>
<body>
<table align="center" bgcolor="#FFFFFF">
<tr>
<td class="ma1h"><div align="center">
<p> </p>
<p>Orçamento para Cliente</p>
<p> </p>
</div></td>
</tr>
<tr>
<td><table align="center">
<tr>
<td class="me1"><div align="center"><span class="me1bb">Nome</span>: <%=(detalhe.Fields.Item("nomecliente").Value)%> | <span class="me1bb">Login</span>:<%=(detalhe.Fields.Item("fkcliente").Value)%> | <span class="me1v">ID Cliente</span>: <%=(detalhe.Fields.Item("idcliente").Value)%> | <span class="me1bb">E-mail</span>: <%=(detalhe.Fields.Item("email").Value)%><br />
</div></td>
</tr>
<tr>
<td class="me1"><div align="center"><span class="me1bb">Cidade</span>: <%=(detalhe.Fields.Item("cidade").Value)%> | <span class="me1bb">Telefone</span>: <%=(detalhe.Fields.Item("telefone").Value)%></div></td>
</tr>
<tr>
<td><table border="1">
<tr>
<td class="me1bv">Número</td>
<td class="me1bv">Produto</td>
<td class="me1bv">Cód. Loja</td>
<td class="me1bv"><div align="center">Valor Unit</div></td>
<td class="me1bv"><div align="center">Qtde.</div></td>
<td class="me1bv"><div align="center">Unid.</div></td>
<td class="me1bv">Data / Hora</td>
<td class="me1bv">Excluir</td>
</tr>
<% While ((Repeat1__numRows <> 0) AND (NOT detalhe.EOF)) %>
<tr>
<td class="fo1l"><%=(detalhe.Fields.Item("idorcamento").Value)%></td>
<td width="150" class="fo1l"><%=(detalhe.Fields.Item("produto").Value)%></td>
<td class="fo1l"><%=(detalhe.Fields.Item("idloja").Value)%></td>
<td width="300" class="fo1l"><div align="center">
<form name="frm">
<input name="valor" type="text" value="<%=(detalhe.Fields.Item("valor").Value)%>" size="10">
<input name="quantidade" type="text" value="<%=(detalhe.Fields.Item("quantidade").Value)%>" size="5">
<input name="total" type="text" size="10">
<input type="button" value="OK" onClick="Calcula()">
</form>
<label></label>
</div></td>
<td class="fo1l"><div align="center"><%=(detalhe.Fields.Item("quantidade").Value)%></div></td>
<td class="fo1l"><div align="center"><%=(detalhe.Fields.Item("unidade").Value)%></div></td>
<td class="fo1l"><%=(detalhe.Fields.Item("data").Value)%></td>
<td class="fo1l"><form id="form1" name="form1" method="post" action="<%=MM_editAction%>">
<label>
<input type="submit" name="button" id="button" value="Del" />
</label>
<input type="hidden" name="MM_delete" value="form1" />
<input type="hidden" name="MM_recordId" value="<%= detalhe.Fields.Item("idorcamento").Value %>" />
</form></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
detalhe.MoveNext()
Wend
%>
</table></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td class="me1v">Total: <%=(detalhe_total)%> Iten(s)</td>
</tr>
</table></td>
</tr>
<tr>
<td> </td>
</tr>
</table>
<p> </p>
</body>
</html>
<%
detalhe.Close()
Set detalhe = Nothing
%>