473,385 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

activeXobject connection...

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>
Jul 20 '05 #1
3 11875


Sandra wrote:
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.....
<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");


This is client side JavaScript, are you sure you want to store the data
in the data base with client side JavaScript??
Your code further below indicates you are using ASP with VBScript thus I
strongly suggest to use ASP to store data in the database.
http://www.aspfaq.com/ should help with sample ASP code.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2


Hi Martin Honnen,

Thank you for your answer, I would like to use VBScript, but I don´t
know how do to that, since I need to check if I have more than one item
in the screen and check if the "txtQTD" has value or not..... Could you
help me on that? Is there any command in VBScript similar to .lenght in
Javascript?

thanks again
Sandra

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #3


Sandra Mota wrote:
Thank you for your answer, I would like to use VBScript, but I don´t
know how do to that, since I need to check if I have more than one item
in the screen and check if the "txtQTD" has value or not..... Could you
help me on that? Is there any command in VBScript similar to .lenght in
Javascript?


I suggested to use ASP, that is server side scripting, to store values
in a data base. In ASP's object model there are a lot of collections like
Request.Form
or
Request.QueryString
and all those collections have a property named
Count
to check the length of the collection whether you use JavaScript or
VBScript.
I think you thoroughly confuse client side and server side scripting, as
you have ASP go for server side scripting and process the submitted form
data there and store it in your data base. As suggested
http://www.aspfaq.com/
is a good place to start.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Nomad | last post by:
I'm trying to load an XML document into the DOM using the ActiveXObject I've succeeded in doing this on one machine. Which shouldn't becaus I've checked for the ActiveXObject and it doesn't...
1
by: Brian McPheeters | last post by:
Is there anyway to get ActiveXObject('Msxml2.XMLHTTP') to work with Mac IE 5.1 on the client side? I need to get a text response from the server with javascript so I can parse it. This seems to...
2
by: Marcin Zmyslowski | last post by:
Hello all! I have installed MSDE on my local computer - Windows 2000 Professional. I have created a function which runs me a link whose path is placed in the input field. This function looks...
2
by: Peter Kirk | last post by:
Hi there, I am having trouble with ActiveXObject. I have a function which includes this snippet: alert('INIT 1'); orgdoc = new ActiveXObject('Microsoft.XMLDOM'); alert('INIT 2'); I see...
9
by: Don | last post by:
I'm trying to run the following page on my desktop from my host server. It works just fine if I run it from my desktop, but not if I run it from the server. I get "Error: Permission denied" on...
0
by: ndronen | last post by:
Hi: I have a DLL compiled from C# that I have to be able to use within an HTML document. This is relatively easy to do following the suggestions on this page: ...
3
by: ashvinguna | last post by:
HI, I AM TRYING TO ACCESS MS SQL 2005 DATABASE THROUGH JAVASCRIPT BUT IT GIVING ME RUNTIME ERROR. <SCRIPT type="text/javascript"> <!-- function Aufruf(){ var rst; var dsn; var sql;
11
by: nitinsingh1 | last post by:
Hi, I am using ActiveXobject as var xp = new ActiveXObject("WPrint.PrintCtl"); in my JSP application. I have heard that using ActiveXobject may be dangerous for my application as i am using...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.