Hi All,
What is wrong with my code....The function "function ValidaProdutos()"
is not working....I need to execute the procedure to insert data in a
Database.... What can I do to have this code working.... I don't get
error line, but nothing happen in my database.... I think the
connection is not right.... Could anyone give a sample code on how to
do that.....
thank you very much....
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head>
<script language='JavaScript'>
function ValidaProdutos()
{
var Qtd_Solic;
var Cod_Presente;
valor = 0;
var SQL;
var connString = "Provider=SQLOLEDB.1;Persist Security
Info=False;User ID=sa;Data Source="CLESIO ";Initial Catalog=DBO_CRE";
var ObjConn = new ActiveXObject("ADODB.CONNECTION");
ObjConn.open( connString);
var objRs = new ActiveXObject("ADODB.CONNECTION");
if( document.all['txtQTD'].length )
{
for(i=0; i < document.all['txtQTD'].length ; i++)
{
if( document.all['txtQTD'][i].value != '' &&
document.all['txtQTD'][i].value > 0)
{
Qtd_Solic = document.all['txtQTD'][i].value
Cod_Presente = document.all['Cod_Presente'][i].value
SQL = "Exec dbo_CRE.dbo.sp_IN_0029T " + session("Cod_LsPadrao") +
"," + document.all['Cod_Presente'][i].value + "," +
document.all['txtQTD'][i].value + "," +
document.all['txtQTD'][i].value + "," + session("Cod_Func");
objRs = ObjConn.execute(SQL);
}
}
}
</script>
<body bgcolor="#FFFFFF" text="#000000">
..
..
.. more code here....
..
..
<form name="form" method="post" action="">
<table width=80%" border="0">
<tr valign="bottom">
<td width="10%" class="LabelAsp" nowrap bgcolor= '#007EBB'>
<div align="center"><font color="#FFFFFF">Código
</font></div>
</td>
<td width="50%" class="LabelAsp" bgcolor= '#007EBB'>
<div align="center"><font color="#FFFFFF">Descrição
</font></div>
</td>
<td width="10%" class="LabelAsp" bgcolor= '#007EBB'>
<div align="center"><font color="#FFFFFF">Valor</font> </div>
</td>
<td width="10%" class="LabelAsp" nowrap align="left" bgcolor=
'#007EBB'>
<div align="center"><font color="#FFFFFF">Qtd.</font>
</div>
</td>
</tr>
<%
while Not retorno.Eof
%>
<tr>
<td bgcolor="#DCECF5" width="10%" height="20" class="LabelAsp"
name="Cod_Presente"><%=retorno("COD_PRESENTE")%></td>
<input type="hidden" name="Cod_Presente" size="3" maxlength="3"
value="<%=retorno("COD_PRESENTE")%>">
<td bgcolor="#DCECF5" width="50%" class="LabelAsp"
name="Desc_Presente" maxlenght="20"><%=retorno("DSC_PRESENTE")%></td>
<td bgcolor="#DCECF5" width="10%" height="20" class="LabelAsp"
name="Valor_Presente"><%=retorno("VAL_PRC_UNIT")%> </td>
<td bgcolor="#DCECF5" width="10%">
<input type="text" name="txtQTD" size="3" maxlength="3"
value="" onKeyUp="javascript:ValidaNumber();">
</td>
</tr>
<%
retorno.MoveNext
Wend
retorno.close
Set retorno = Nothing
cnSQL.close
Set cnSQL = Nothing
%>
</table>
<input type="submit" name="Submit3" value="Incluir"
onclick="ValidaProdutos
();return false;">
</form>