Re: zero-length string

2002-07-30 Thread Bart Lateur

On Tue, 30 Jul 2002 15:28:03 -0400, Nick Hoffman [UWO] wrote:

>How exactly do I set the values of vars to undef? Like this?:
>
>foreach $temp (%Info)
>   {
>   if ($Info{$temp} eq "")
>   {$Info{$temp} = undef;}
>   }

If you were to use 

foreach $temp (keys %Info)

then it would work (well), yes.

-- 
Bart.



RE: zero-length string

2002-07-30 Thread Nick Hoffman [UWO]

I just tried the undef and it works. Thanks a bundle for the tip!  =)

-Nick

>  -Original Message-
>  From: Bart Lateur [mailto:[EMAIL PROTECTED]]
>  Sent: July 30, 2002 3:23 PM
>  To: DBI-Users
>  Subject: Re: zero-length string
>  
>  
>  On Tue, 30 Jul 2002 15:16:18 -0400, Nick Hoffman [UWO] wrote:
>  
>  >I'm trying to insert into a table where only 3 fields (1 being 
>  the primary
>  >key) are required, yet I get the following error when I execute:
>  >
>  >---
>  >Died while executing:
>  >[Microsoft][ODBC Microsoft Access Driver] Field 
>  'Volunteers.Email' cannot be
>  >a zero-length string. (SQL-S1000)(DBD: st_execute/SQLExecute err=-1)
>  >---
>  >
>  >However, when I look at the design view of the table Volunteers 
>  (Access2000
>  >DB), the Email field is not required.
>  
>  To Access, there is a difference between a zero length string, and a
>  NULL. The latter should be acceptable, according to what you say, while
>  the former isn't.
>  
>  So: if you find a zero length string, replace it with undef. that should
>  be enough.
>  
>  -- 
>   Bart.



RE: zero-length string

2002-07-30 Thread Nick Hoffman [UWO]

How exactly do I set the values of vars to undef? Like this?:

foreach $temp (%Info)
{
if ($Info{$temp} eq "")
{$Info{$temp} = undef;}
}

Thanks,
Nick

>  -Original Message-
>  From: Bart Lateur [mailto:[EMAIL PROTECTED]]
>  Sent: July 30, 2002 3:23 PM
>  To: DBI-Users
>  Subject: Re: zero-length string
>  
>  
>  On Tue, 30 Jul 2002 15:16:18 -0400, Nick Hoffman [UWO] wrote:
>  
>  >I'm trying to insert into a table where only 3 fields (1 being 
>  the primary
>  >key) are required, yet I get the following error when I execute:
>  >
>  >---
>  >Died while executing:
>  >[Microsoft][ODBC Microsoft Access Driver] Field 
>  'Volunteers.Email' cannot be
>  >a zero-length string. (SQL-S1000)(DBD: st_execute/SQLExecute err=-1)
>  >---
>  >
>  >However, when I look at the design view of the table Volunteers 
>  (Access2000
>  >DB), the Email field is not required.
>  
>  To Access, there is a difference between a zero length string, and a
>  NULL. The latter should be acceptable, according to what you say, while
>  the former isn't.
>  
>  So: if you find a zero length string, replace it with undef. that should
>  be enough.
>  
>  -- 
>   Bart.



Re: zero-length string

2002-07-30 Thread Bart Lateur

On Tue, 30 Jul 2002 15:16:18 -0400, Nick Hoffman [UWO] wrote:

>I'm trying to insert into a table where only 3 fields (1 being the primary
>key) are required, yet I get the following error when I execute:
>
>---
>Died while executing:
>[Microsoft][ODBC Microsoft Access Driver] Field 'Volunteers.Email' cannot be
>a zero-length string. (SQL-S1000)(DBD: st_execute/SQLExecute err=-1)
>---
>
>However, when I look at the design view of the table Volunteers (Access2000
>DB), the Email field is not required.

To Access, there is a difference between a zero length string, and a
NULL. The latter should be acceptable, according to what you say, while
the former isn't.

So: if you find a zero length string, replace it with undef. that should
be enough.

-- 
Bart.



zero-length string

2002-07-30 Thread Nick Hoffman [UWO]

I'm trying to insert into a table where only 3 fields (1 being the primary
key) are required, yet I get the following error when I execute:

---
Died while executing:
[Microsoft][ODBC Microsoft Access Driver] Field 'Volunteers.Email' cannot be
a zero-length string. (SQL-S1000)(DBD: st_execute/SQLExecute err=-1)
---

However, when I look at the design view of the table Volunteers (Access2000
DB), the Email field is not required. Why then would it be a problem that
I'm passing an empty var to use for Volunteers.Email??

Any input would be great. Thanks!
Nick