|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
You don't need a fax machine to get faxes. Get a fax-to-email fax number from CallWave. Try it free.
|
|
#1
|
|||
|
|||
|
VBScript Code
Hii Theree
I have been trying for so long but this simple code does not seems to work. I would really be grateful if you can plss help me out with this code.The button in the code is not working. It does not get activated on clicking and there isno error message that that I am getting. I am at my wit's end.plss help me. <html> <head> </head> <body> <form method="POST" action="--WEBBOT-SELF--"> <input type="button" value="load data" OnClick="loaData();"> </form> <script language="VBScript"> sub loadData() dim conn dim rs dim qry msgbox "hi" Set conn = CreateObject("ADODB.Connection") conn.CursorLocation = 3 Set rs = CreateObject("ADODB.Recordset") conn.Open "TestDB" ': Queries qry = "Select * from q4 rs.Open qry, conn, adOpenStatic if not rs.eof then rs.movelast total = rs.recordcount rs.movefirst msgbox total & " records from Queries were loaded",,"" end if conn.close set rs = nothing set conn = nothing end sub </script> </body> </html> Thanks so much Ravi |
|
#2
|
||||
|
||||
|
Your mixing different technologies here.
A simple VBScript example: Code:
<html> <script language="VBScript"> sub loadData_onClick msgbox "Hi" end sub </script> <body> <form method="POST" action="--WEBBOT-SELF--"> <input type="button" name="loadData" value="load data"> </form> </body> </html> Notice that the button name is set to "loadData" and the sub in the script section is called "loadData_onClick" The first section is the name, the second is the event. This sub will be executed on the click of the button. |
|
#3
|
|||
|
|||
|
I have noticed that you have not confined your coding to the standards as suggested in any programming manual when it comes to coding.
The first problem you have is the key to why you can't debug your entire code set, first off your button should not contain any sub-routine that is terminated by the ";" token. Wrong: <input type="button" value="load data" OnClick="loaData();"> Correnct: <input type="button" value="load data" OnClick="loaData()" language="VBS"> Note: Try and declare your subroutines this way, emphasis on indentation and where the rroutine is defined. Public Sub LoadData() .... .... End Sub Fixing this will then allow you to get a plethora of Logical Errors and Syntax Error. These will then lead you ro what you are trying to get done. The second major problem you have shown is that you have not learnt how to properly manipulate database using VBScript. This topic is very wide, but I suggest you get with URL and get yourslef their latest VBScript Reference. This will guide you to how to solve your problem. I hope you have learnt a thing or two about VBScript, the most obvious is that it SUCKS!!! |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > VBScript Code |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|