473,405 Members | 2,334 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,405 software developers and data experts.

SQL - Updating Empty Text Field is enterring -1

I'm trying to do a simple update like I have done countless times
before.

However, when I update the empty fields in this table it places a -1
into the field rather than the enterred value.

It is indexed with duplicates allowed. It says that zero lenght is
set to yes.

What can I do about this?
if Request.form("ouserid") <> "" Then
var2 = " and userid = '" & Request.form("ouserid") & "' "
Else
var2 = " and userid is null "
End if
if Request.form("orepid") <> "" Then
var1 = " repid = '" & Request.form("orepid") & "'"
Else
var1 = " repid is null "
End if

"Update [Website Settings] set userid = '" & REquest.form("userid") &
"' and repid = '" & Request.form("repid") & "' where " & var1 & var2
& var3
Thanks!
Jul 20 '05 #1
2 5657
> "Update [Website Settings] set userid = '" & REquest.form("userid") &
"' and repid = '" & Request.form("repid") & "' where " & var1 & var2
& var3


Response.write this to the screen, instead of executing it, and examine the
result.
Jul 20 '05 #2
[posted and mailed, please reply in news]

Scott Hoff (SH***@FIRSTHEARTLAND.COM) writes:
However, when I update the empty fields in this table it places a -1
into the field rather than the enterred value.
...
"Update [Website Settings] set userid = '" & REquest.form("userid") &
"' and repid = '" & Request.form("repid") & "' where " & var1 & var2
& var3


If that is all that happens, consider yourself lucky. A malicious
user could use the above for SQL intrusion, and SQL Server to execute
commands you sure did not intend him to. For a starter, enter
O'Brien in userid.

--
Erland Sommarskog, SQL Server MVP, so****@algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #3

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

Similar topics

11
by: Jason | last post by:
Let's say I have an html form with 20 or 30 fields in it. The form submits the fields via POST to a php page which updates a table in a database with the $_POST vars. Which makes more sense? ...
2
by: TTD | last post by:
Hi, I have a form (input type) which is based on a table. Let's say it has 2 fields 1: numeric keyfield 2: textfield. When the form opens the numeric is automatically added with 1. When I...
5
by: junglist | last post by:
Hi guys, I've been trying to implement an editable datagrid and i have been succesful up to the point where i can update my datagrid row by row. However what used to happen was that once i updated...
2
by: jtvc | last post by:
I'm trying to insert a record on an sql server database table that has among others a text type field. The insert happens without errors and all the fields show the correct information except for...
1
by: Brad Pears | last post by:
I am using vb.net 2005 and SQL server 2000. In my table I have a date field of type "smalldatetime". In my vb application, the user may or may not enter a date value into the appropriate text box....
0
by: TechnoAtif | last post by:
<?php include "dbconnect.php"; include "commonFunc.php"; ?> <!----------------------------------> <table width="80%" border="1" cellpadding="2" cellspacing="0"> <tr > <td...
0
by: Mike | last post by:
So here's the situation (.NET 2.0 btw): I have a form, and on this form is a textbox among many other databound controls. The textbox is bound to a field in a data table via the Text property. ...
1
by: cerilocke | last post by:
I have a repeater in which I have a hidden field (input type = hidden), a textbox (asp:TextBox), a checkbox (input type = checkbox) and a label (asp:Label). I have bound all four items to the same...
0
by: Dan | last post by:
Hi, I have a detailsview with two fields: in editmode, one is a textbox and the other is a dropdownlist. i want to update both fields using the detailsview. My problem: when clicking on the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
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
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
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.