ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 9th, 2003, 10:02 PM
imustgo imustgo is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 7 imustgo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
sql UPDATE table

hi i need help here

i keep getting this error : Data type mismatch in criteria expression.

i try to update a table wich one of the fields has to be blank (trying to delete information) Here's how the code goes:

sql="UPDATE members SET "
sql = sql & "MbrNick = '" & wMbrNick & "',"
sql = sql & "MbrFirst = '" & wMbrFirst & "',"
sql = sql & "MbrLast = '" & wMbrLast & "',"
sql = sql & "MbrOpt = ''," <---- (this is ' ' , " )
sql = sql & " WHERE MbrNb=" & wMbrNb
conn.Execute sql
[...]

i've tried MbrOpt = '3'," it works. but if i leave it blank it doesn't work... how could i delete what is in MbrOpt plz?

thanks !
imust

Reply With Quote
  #2  
Old November 10th, 2003, 04:16 AM
m3ckon m3ckon is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: Sheffield UK
Posts: 69 m3ckon User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 57 sec
Reputation Power: 5
Why not just set it to a space and make sure the db allows null for that field, or simply don't include it in your update statement

Failing that why not just delete it altogether from your database?


M3ckon

Reply With Quote
  #3  
Old November 10th, 2003, 11:59 AM
imustgo imustgo is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 7 imustgo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
thanx m3ckon but it doesn't work. When i put the value " " in a text field it's fine. But for numeric fields, i can'T do this. Actually, there is a value in mbrOpt. (in my asp web page) The member now wants to delete the value on this fields --> leave it blank...

well you gave me an idea.. I'll set all numeric fields with the default value "0". Then on the html form, show textbox values that doesn't contains "0" otherwise let the textbox blank. What a d**n waste of time coding but... I have no choice... or simply find a way to delete what's in numeric fields....

if someone knows plz tell!

imust

Reply With Quote
  #4  
Old November 11th, 2003, 09:28 AM
jstrohofer jstrohofer is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: Cincinnati, OH USA
Posts: 111 jstrohofer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 3 sec
Reputation Power: 5
If you allow nulls on that field, couldn't you just set it to NULL?
It's a numeric field and it shouldn't accept a string such as '' or even ' '.

Try this:

sql="UPDATE members SET "
sql = sql & "MbrNick = '" & wMbrNick & "', "
sql = sql & "MbrFirst = '" & wMbrFirst & "', "
sql = sql & "MbrLast = '" & wMbrLast & "', "
sql = sql & "MbrOpt = NULL "
sql = sql & "WHERE MbrNb=" & wMbrNb

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > sql UPDATE table


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway