Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > I need help. I am having trouble clearing a field in an Access database.

Reply
Thread Tools

I need help. I am having trouble clearing a field in an Access database.

 
 
Tim
Guest
Posts: n/a
 
      08-01-2003
I don't know what to use to clear a field in an MSAccess database. I
can update fields in the database and delete whole records but I have
not figured out how to clear a single field.

This is what I am using to update the database.

Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DSN=DataBase"
SQL = "UPDATE Table SET "
SQL = SQL & "thefield='" & Request.Form("thefield1") & "', "
SQL = SQL & "theDate='" & FormatDateTime(Now,2) & "' "
SQL = SQL & "WHERE theName = '" & Request.Form("theName") & "' "

Set RSUpdate=Conn.Execute(SQL)
Conn.Close
Set RSUpdate=nothing

I get an error if I try to update a field with a value of nothing "".
 
Reply With Quote
 
 
 
 
Ray at
Guest
Posts: n/a
 
      08-01-2003
Either set it to '' or to null, depending on what you'd like.

UPDATE TheTable SET TheColumn='' WHERE Something=AcertainValue
or
UPDATE TheTable SET TheColumn=NULL WHERE Something=AcertainValue

Ray at work

"Tim" <> wrote in message
news: om...
> I don't know what to use to clear a field in an MSAccess database. I
> can update fields in the database and delete whole records but I have
> not figured out how to clear a single field.
>
> This is what I am using to update the database.
>
> Set Conn = Server.CreateObject("ADODB.Connection")
> Conn.Open "DSN=DataBase"
> SQL = "UPDATE Table SET "
> SQL = SQL & "thefield='" & Request.Form("thefield1") & "', "
> SQL = SQL & "theDate='" & FormatDateTime(Now,2) & "' "
> SQL = SQL & "WHERE theName = '" & Request.Form("theName") & "' "
>
> Set RSUpdate=Conn.Execute(SQL)
> Conn.Close
> Set RSUpdate=nothing
>
> I get an error if I try to update a field with a value of nothing "".



 
Reply With Quote
 
 
 
 
Roy in
Guest
Posts: n/a
 
      08-01-2003
set it to null instead
SQL = SQL & "thefield='" & Request.Form("thefield1") & "', "
SQL = SQL & "theDate=NULL "
SQL = SQL & " WHERE theName = '" & Request.Form("theName") & "' "



"Tim" <> wrote in message
news: om...
> I don't know what to use to clear a field in an MSAccess database. I
> can update fields in the database and delete whole records but I have
> not figured out how to clear a single field.
>
> This is what I am using to update the database.
>
> Set Conn = Server.CreateObject("ADODB.Connection")
> Conn.Open "DSN=DataBase"
> SQL = "UPDATE Table SET "
> SQL = SQL & "thefield='" & Request.Form("thefield1") & "', "
> SQL = SQL & "theDate='" & FormatDateTime(Now,2) & "' "
> SQL = SQL & "WHERE theName = '" & Request.Form("theName") & "' "
>
> Set RSUpdate=Conn.Execute(SQL)
> Conn.Close
> Set RSUpdate=nothing
>
> I get an error if I try to update a field with a value of nothing "".



 
Reply With Quote
 
Tom B
Guest
Posts: n/a
 
      08-01-2003
As Ray and Roy said set it to null, but ensure that the field allows nulls.

"Tim" <> wrote in message
news: om...
> I don't know what to use to clear a field in an MSAccess database. I
> can update fields in the database and delete whole records but I have
> not figured out how to clear a single field.
>
> This is what I am using to update the database.
>
> Set Conn = Server.CreateObject("ADODB.Connection")
> Conn.Open "DSN=DataBase"
> SQL = "UPDATE Table SET "
> SQL = SQL & "thefield='" & Request.Form("thefield1") & "', "
> SQL = SQL & "theDate='" & FormatDateTime(Now,2) & "' "
> SQL = SQL & "WHERE theName = '" & Request.Form("theName") & "' "
>
> Set RSUpdate=Conn.Execute(SQL)
> Conn.Close
> Set RSUpdate=nothing
>
> I get an error if I try to update a field with a value of nothing "".



 
Reply With Quote
 
Tim
Guest
Posts: n/a
 
      08-05-2003
Thanks for the info. I'll check things out and try the changes.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
javascript validation for a not required field, field is onlyrequired if another field has a value jr Javascript 3 07-08-2010 10:33 AM
1.Enter space bar for field names and save the field.The field shoud not get saved and an alert should be there as"Space bars are not allowed" Sound Javascript 2 09-28-2006 02:43 PM
RequiredEntryValidation triggers after clearing field =?Utf-8?B?RGFiYmxlcg==?= ASP .Net 0 08-30-2006 03:34 AM
Need help. Having trouble with security on my web service. Ken Varn ASP .Net Security 1 07-09-2004 01:35 PM
Having trouble adding Recordset into access database through ASP Anand ASP General 1 02-06-2004 01:18 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57