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

ASP/VBscript SQL statements are not executing

I am writing a timepunch addition to an existing timecard web app using ASP and Internet Explorer tied to a SQL 7 backend. I have isolated enough of the problem down to what I think is trying to submit the statements without using the classic form/response schema. Here is a very dumbed down version of what I'm doing since I think the problem may be on a basic structural level (I hope). The SQL statements work and so does the button logic so I figure it must be structural.

vbscript,session variables and SQL connection and recordset stuff here

'sample of sql insert statement (not the real thing)
set sqlTimeIn = Server.CreateObject ("ADODB.Command")
sqlTimeIn.ActiveConnection = MM_timecardasp_STRING
sqlTimeIn.CommandText = "INSERT INTO dbo.tbltimepunchcard (SSN) VALUES ( ) "
sqlTimeIn.CommandType = 1
sqlTimeIn.CommandTimeout = 0
sqlTimeIn.Prepared = true


testpin = request.form("punchcard.onclick") 'button gets pushed

case TimeIn
sqlTimeIn.Execute()
case LunchOut
some sql update statement
case LunchIn
some sql update statement
case TimeOut
some sql update statement
End select

HTML stuff including body
some table data displayed from a recordset
<%
If punchtype <> "TimeIn" Then 'button value logic
If vLunchOut="" then 'default value is "TimeIn"
punchtype = "LunchOut" 'for no record
response.write "punchout"& punchtype
ElseIf vLunchIn="" and punchtype <> "TimeIn" then
punchtype = "LunchIn"
response.write "punchout"& punchtype
ElseIf vTimeOut="" and punchtype <> "TimeIn" then
punchtype = "TimeOut"
response.write "punchout"& punchtype
End If
End If
%>
<p align="center">
<label> 'this is the button that's suppose to trigger the SQL
<input name="timepunch" type="button" class="style29" id="timepunch" value=<%=punchtype%>/>
</label>
</p>
</body>
</html>


Nothing happens. I'm sure it's some kind of client side vs. server side error on my part. Please help.
Apr 9 '07 #1
3 4777
jhardman
3,406 Expert 2GB
There are hundreds of things that can go wrong with sql in vbscript, the one thing they all have in common is they generate an error. Since you ahve a working and established script page, I assume you have some kind of error handler in place. I bet that when you attempt this (and I don't see a problem, I'm just guessing there is one there somewhere) the error handler is clearing the error without showing it to you. Search for the "on error" line and comment it out then run the page. I bet you will get an error.

Let me know what you find.

Jared
Apr 10 '07 #2
Actually I purposely left out an onerror statement so I can hunt down all the errors. I am a little new to ASP programming so I'm not sure of everthing I'm doing however I do get an error when I push the button but in the browser page at the botton. It just says Error when I push the button. In all the other errors I've got I get a compilation error page and can see what's going on.
Apr 10 '07 #3
jhardman
3,406 Expert 2GB
hmm. I've never used adodb.command. Have you considered swtching to ADODB.recordset?
Expand|Select|Wrap|Line Numbers
  1. set sqlTimeIn = Server.CreateObject ("ADODB.Recordset")
  2. query = "SELECT * FROM dbo.tbltimepunchcard WHERE ssn = '" & vSSN & "'"
  3. sqlTimeIn.open objConnection query, adOpenDynamic, adLockOptimistic
  4. sqlTimeIn.addNew
  5.    'add each value on its own line
  6.    sqlTimeIn("ssn") = vSSN
  7.    'etc
  8. sqlTimeIn.update
That's how I always try to do that kind of thing.

Jared
Apr 11 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Brittany | last post by:
can someone explain to me what if else staments do and what while statements do.
3
by: Valentina Boycheva | last post by:
Is there a way to make programs written in these two languages communicate with each other? I am pretty sure that VBScript can access a Python script because Python is COM compliant. On the other...
1
by: Valentina Boycheva | last post by:
Thanks for the reply. I already have "Learning Python" from Mark Lutz and David Ascher, which covers 2.3 (I am in 2.4). However, it seems like heavy artillery to me. What I want is, for instance,...
20
by: Harag | last post by:
Hi All. I'm stating out doing some web developing. I was wondering which of the server side languages should I concentrate on and learn. I Know CSS, HTML, T-SQL I can look at the client...
3
by: Dana | last post by:
I have a form with a couple of dropdown fields. the dropdown fields get the value from one table which is a reference table. The table consists of 3 columns - type, id, name. An example would...
4
by: chris.dunigan | last post by:
I'm looking for an example of how to execute an existing DTS­ package from an ASP (VB)script and would appreciate any and all response. ­I don't even know if it's possible Thanks - Chuck...
11
by: pmarisole | last post by:
I am using the following code to split/join values in a multi-select field. It is combining all the values in All the records into one long string in each record in recordset. Example: I have a...
10
by: Shadow Lynx | last post by:
That subject packs a whallop, so let me explain in better detail what's happening and how it relates to ASPX pages... In a nutshell, if the first <script /on a page is of type "text/vbscript",...
0
by: ismailc | last post by:
Good day, I need help. I have an application that uses aspx pages together with vbscript window for developer coding. Now the page has an <input type='file'> upload object. The problem is...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.