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>Untitl ed Document</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head>
<script language='JavaS cript'>
function ValidaProdutos( )
{
var Qtd_Solic;
var Cod_Presente;
valor = 0;
var SQL;
var connString = "Provider=SQLOL EDB.1;Persist Security
Info=False;User ID=sa;Data Source="CLESIO ";Initial Catalog=DBO_CRE ";
var ObjConn = new ActiveXObject(" ADODB.CONNECTIO N");
ObjConn.open( connString);
var objRs = new ActiveXObject(" ADODB.CONNECTIO N");
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_Ls Padrao") +
"," + document.all['Cod_Presente'][i].value + "," +
document.all['txtQTD'][i].value + "," +
document.all['txtQTD'][i].value + "," + session("Cod_Fu nc");
objRs = ObjConn.execute (SQL);
}
}
}
</script>
<body bgcolor="#FFFFF F" 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="#DCECF 5" width="10%" height="20" class="LabelAsp "
name="Cod_Prese nte"><%=retorno ("COD_PRESENTE" )%></td>
<input type="hidden" name="Cod_Prese nte" size="3" maxlength="3"
value="<%=retor no("COD_PRESENT E")%>">
<td bgcolor="#DCECF 5" width="50%" class="LabelAsp "
name="Desc_Pres ente" maxlenght="20"> <%=retorno("DSC _PRESENTE")%></td>
<td bgcolor="#DCECF 5" width="10%" height="20" class="LabelAsp "
name="Valor_Pre sente"><%=retor no("VAL_PRC_UNI T")%></td>
<td bgcolor="#DCECF 5" width="10%">
<input type="text" name="txtQTD" size="3" maxlength="3"
value="" onKeyUp="JavaSc ript:ValidaNumb er();">
</td>
</tr>
<%
retorno.MoveNex t
Wend
retorno.close
Set retorno = Nothing
cnSQL.close
Set cnSQL = Nothing
%>
</table>
<input type="submit" name="Submit3" value="Incluir"
onclick="Valida Produtos
();return false;">
</form>
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>Untitl ed Document</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head>
<script language='JavaS cript'>
function ValidaProdutos( )
{
var Qtd_Solic;
var Cod_Presente;
valor = 0;
var SQL;
var connString = "Provider=SQLOL EDB.1;Persist Security
Info=False;User ID=sa;Data Source="CLESIO ";Initial Catalog=DBO_CRE ";
var ObjConn = new ActiveXObject(" ADODB.CONNECTIO N");
ObjConn.open( connString);
var objRs = new ActiveXObject(" ADODB.CONNECTIO N");
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_Ls Padrao") +
"," + document.all['Cod_Presente'][i].value + "," +
document.all['txtQTD'][i].value + "," +
document.all['txtQTD'][i].value + "," + session("Cod_Fu nc");
objRs = ObjConn.execute (SQL);
}
}
}
</script>
<body bgcolor="#FFFFF F" 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="#DCECF 5" width="10%" height="20" class="LabelAsp "
name="Cod_Prese nte"><%=retorno ("COD_PRESENTE" )%></td>
<input type="hidden" name="Cod_Prese nte" size="3" maxlength="3"
value="<%=retor no("COD_PRESENT E")%>">
<td bgcolor="#DCECF 5" width="50%" class="LabelAsp "
name="Desc_Pres ente" maxlenght="20"> <%=retorno("DSC _PRESENTE")%></td>
<td bgcolor="#DCECF 5" width="10%" height="20" class="LabelAsp "
name="Valor_Pre sente"><%=retor no("VAL_PRC_UNI T")%></td>
<td bgcolor="#DCECF 5" width="10%">
<input type="text" name="txtQTD" size="3" maxlength="3"
value="" onKeyUp="JavaSc ript:ValidaNumb er();">
</td>
</tr>
<%
retorno.MoveNex t
Wend
retorno.close
Set retorno = Nothing
cnSQL.close
Set cnSQL = Nothing
%>
</table>
<input type="submit" name="Submit3" value="Incluir"
onclick="Valida Produtos
();return false;">
</form>
Comment