473,411 Members | 1,991 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,411 software developers and data experts.

Calling a function from a button...easy, right?!

I just have a function that does some sql stuff. When I run this I get an
object expected error on the <input type="button"... line
Does anyone have a suggestion?
This is written for IE only - it's an internal tool...

Here is the code that fails.
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<html>
<head>
<title>tool</title>

<%
Function flushActivity
Dim oConn, cSql
cSql= "UPDATE activity SET Content= '' WHERE Class_Number = 2"
set oConn = Server.CreateObject("ADODB.connection")
oConn.Open Session("DSN")
oConn.Execute(cSql)
Response.write("executing: " & cSql & "<br>")
oConn.Close
set oConn = nothing
End Function
%>

</head>
<body>

<form>
<input type="button" value="Flush Activity" onclick="flushActivity()">
</form>
</body>
</html>

Nov 19 '05 #1
3 1301
> I just have a function that does some sql stuff. When I run this I get
an
object expected error on the <input type="button"... line
Does anyone have a suggestion?
This is written for IE only - it's an internal tool...
Here is the code that fails.
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<html>
<head>
<title>tool</title>
<%
Function flushActivity
Dim oConn, cSql
cSql= "UPDATE activity SET Content= '' WHERE Class_Number = 2"
set oConn = Server.CreateObject("ADODB.connection")
oConn.Open Session("DSN")
oConn.Execute(cSql)
Response.write("executing: " & cSql & "<br>")
oConn.Close
set oConn = nothing
End Function
%>

</head>
<body>
<form>
<input type="button" value="Flush Activity" onclick="flushActivity()">
</form>
</body>
</html>


Do you want this to execute on the client or the server? Right now, your
script block is server code while your button's onclick handler is client
side.

Nov 19 '05 #2

"Ryan Trudelle-Schwarz" <ne**@mamanze.com> wrote in message
news:95*********************@news.microsoft.com...
I just have a function that does some sql stuff. When I run this I get
an
object expected error on the <input type="button"... line
Does anyone have a suggestion?
This is written for IE only - it's an internal tool...
Here is the code that fails.
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<html>
<head>
<title>tool</title>
<%
Function flushActivity
Dim oConn, cSql
cSql= "UPDATE activity SET Content= '' WHERE Class_Number = 2"
set oConn = Server.CreateObject("ADODB.connection")
oConn.Open Session("DSN")
oConn.Execute(cSql)
Response.write("executing: " & cSql & "<br>")
oConn.Close
set oConn = nothing
End Function
%>

</head>
<body>
<form>
<input type="button" value="Flush Activity" onclick="flushActivity()">
</form>
</body>
</html>


Do you want this to execute on the client or the server? Right now, your
script block is server code while your button's onclick handler is client
side.


Interesting... the function accesses a sql database, which is server side.
I assumed that the function was client side. whats the best way to go about
this, given that the db is on the server?

(thanks SO much in advance!)
Nov 19 '05 #3
> "Ryan Trudelle-Schwarz" <ne**@mamanze.com> wrote
I just have a function that does some sql stuff. When I run this I
get
an
object expected error on the <input type="button"... line
Does anyone have a suggestion?
This is written for IE only - it's an internal tool...
Here is the code that fails.
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<html>
<head>
<title>tool</title>
<%
Function flushActivity
Dim oConn, cSql
cSql= "UPDATE activity SET Content= '' WHERE Class_Number = 2"
set oConn = Server.CreateObject("ADODB.connection")
oConn.Open Session("DSN")
oConn.Execute(cSql)
Response.write("executing: " & cSql & "<br>")
oConn.Close
set oConn = nothing
End Function
%>
</head>
<body>
<form>
<input type="button" value="Flush Activity"
onclick="flushActivity()">
</form>
</body>
</html>

Do you want this to execute on the client or the server? Right now,
your script block is server code while your button's onclick handler
is client side.

Interesting... the function accesses a sql database, which is server
side. I assumed that the function was client side. whats the best way
to go about this, given that the db is on the server?

(thanks SO much in advance!)


IIRC, the easiest method is going to be to add a Runat="server" to the button
tag, in which case the button should post back and call the method when clicked.
In case the input type="button" is not wired up to do that, you can use a
<asp:button in its place and get the same functionality (just change the
tag name and change value attribute to text and it should be good).

Nov 19 '05 #4

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

Similar topics

5
by: niftyhawk | last post by:
Hi, Can anybody give me a simple example of how to Call Web Services from Mozilla based Browsers ? I can call web services from IE browser using web service behavior file, without any problems....
19
by: Ross A. Finlayson | last post by:
Hi, I hope you can help me understand the varargs facility. Say I am programming in ISO C including stdarg.h and I declare a function as so: void log_printf(const char* logfilename, const...
6
by: Jon Hyland | last post by:
Ok, I'm a little rusty on this, it should be a simple problem but I can't figure it out. How can I handle form events in my main code page?? I'm creating a Windows App in C#. Rather than make...
6
by: grist2mill | last post by:
I want to create a standard tool bar that appears on all pages that is a control. The toolbar has a button 'New'. What I wolud like when the user clicks on 'New' depends on the page they are on. I...
13
by: James Bond | last post by:
Hello. My 80+ year old father has recently decided to get his first computer. Due to his age (and I suspect lack of playing pong as a child like I did) he lacks the manual dexterity to use a mouse...
0
by: Cleo | last post by:
Hi, I am trying to call a WebService Method written in Weblogic from VB.NET and I am getting the following error. I am using SOAP Caal s from VB.NET. Please find the wsdl file and my code. ...
3
by: Jerome Cohen | last post by:
AI am trying to call a third-party web service. this service expects an XML fragment that contains the request plus other parameter. adding the web reference created the syntax below(reference.vb)....
18
by: John Friedland | last post by:
My problem: I need to call (from C code) an arbitrary C library function, but I don't know until runtime what the function name is, how many parameters are required, and what the parameters are. I...
2
by: k.j.stellema | last post by:
I wonder if this is possible.. i have a couple of anchors inside a page and all have 'pretty' URLs in the form of 'foo/bar/' and 'foo/ béar/'. If the user clicks on such an anchor (they are...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.