Results 1 to 11 of 11

Thread: This is driving me nuts

  1. #1

    Thread Starter
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256

    Angry This is driving me nuts

    Ok, the weblog is still giving some problems. My database table fields are set to not allow nulls but I'm stil able to insert data into the fields. Now everything works fine on my computer but craps up when I upload the project.

    I need some help.
    Last edited by DevGrp; Jun 17th, 2003 at 11:58 PM.

  2. #2

    Thread Starter
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256

    Ok, I'm convinced EhostingBiz.com sucks

    I think I'm going to just host my weblog on my on computer at home. EhostingBiz.com, is just not doing it for me. I create my tables and set the columns to not null, but they still allow null values. Everything works on my computer, so I know its not my code. I'm going to bed now.

  3. #3
    Addicted Member
    Join Date
    Jan 1999
    Posts
    165
    Have you tried another host - a free one just to compare whether its your current.

  4. #4

    Thread Starter
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    No, I have not tried another host. Thats gonna take too much time.
    All I wanna know is. How is it possible to insert null values in columns that are set to not allow null values.

  5. #5
    Addicted Member
    Join Date
    Jan 1999
    Posts
    165
    Its not possible - except you can add checks which only apply to new data ignoring previous rows but cannot recall if this can apply to nullability!!!
    I can't believe this can happen against the way SQL Server works.
    Can you post you tabel schema?

  6. #6
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    I would bet that it might be a database setting that is doing this for you. I would go to the database forum and ask why this isn't working like you want it.

    I always verify the data I am throwing at the database anyway, I can usually head off reads and writes that won't work based on the rules I have set. This first acts like a filter, and also as a performance enhancement because you don't have to needlessly access the database unless you are 95% sure the data is good.

    If I have time today, I will check into whether or not I can do this on my DB.

    Also, it would be helpful if you generated a setup script of you database and posted it here. We might be able to find a problem in there.

  7. #7

    Thread Starter
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    Originally posted by hellswraith
    I would bet that it might be a database setting that is doing this for you. I would go to the database forum and ask why this isn't working like you want it.

    I always verify the data I am throwing at the database anyway, I can usually head off reads and writes that won't work based on the rules I have set. This first acts like a filter, and also as a performance enhancement because you don't have to needlessly access the database unless you are 95% sure the data is good.

    If I have time today, I will check into whether or not I can do this on my DB.

    Also, it would be helpful if you generated a setup script of you database and posted it here. We might be able to find a problem in there.
    I think thats what is happening. Another problem I have is that my RequiredValidator controls wont fire when I upload my project. As I've said before everything works fine on my computer, so this is kinda strange. To force the RequiredValidators to fire, I had to put my code in an if(Page.IsValid) block. I did'nt really want to do that since the page is posting back.

    Here is the script.
    Attached Files Attached Files

  8. #8
    New Member
    Join Date
    Mar 2003
    Posts
    9

    About your database and nulls

    If you select NO to allow nulls then you will have to supply data to be inserted into the field when a record is inserted. If you have no data to populate the field then sometimes an empty string will do.

    But the easiest way I have found is to supply a default value for the field. For string fields and empty string will do. For numerics a zero. For date fields you can use GetDate() as the default or supply a non-sense date like '01-01-1900'.

    And a null is a null is nothing...
    Brad

  9. #9

    Thread Starter
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    Should'nt the DB throw an exception if the value is null? If I enter data from enterprise manager and leave a column empty, an exception is thrown.

  10. #10
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    OK, I am not sure what columns your having problems with. Here is what I see from the scripts...
    URL and Email in the comments table are set to ALLOW null values. If these are the columns that are giving you trouble, then you need to switch them to Not Null.

    Another thing I have found with ASP.Net is that a empty text box will return a empty string instead of a null value if there is nothing in it. You may be allowed to enter the data because the empty string is being passed therefore it isn't really a null value.

  11. #11

    Thread Starter
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    Originally posted by hellswraith
    OK, I am not sure what columns your having problems with. Here is what I see from the scripts...
    URL and Email in the comments table are set to ALLOW null values. If these are the columns that are giving you trouble, then you need to switch them to Not Null.

    Another thing I have found with ASP.Net is that a empty text box will return a empty string instead of a null value if there is nothing in it. You may be allowed to enter the data because the empty string is being passed therefore it isn't really a null value.
    The url and email columns are suppose to be like that. I'll have to check out what you said about the empty text box. Thanks for help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width