Re: Sending null values in SQL statements

From: Bob Lehmann (nospam_at_dontbotherme.zzz)
Date: 05/23/04

  • Next message: Greg: "Simple SQL query to return data to datagrid."
    Date: Sat, 22 May 2004 19:54:49 -0600
    
    

    You could write a function that formats the value....

    Function FormatDBStr(Field)
       If Not Field = "" Then
          FormatDBStr = "'" & Field & "'"
       Else
          FormatDBStr = "NULL"
       End If
     End Function

    sql = "UPDATE table_name SET field_name=" & FormatDBStr(FieldValue) & "
    WHERE unique_field =something"

    Bob Lehmann

    "James Bowman" <james@jbassoc.biz> wrote in message
    news:10b7a01c44066$5cba4690$a601280a@phx.gbl...
    > I am using an authoring program called Authorware to send
    > student scores to ASP pages which send SQL INSERT and
    > UPDATE statements to an Access database. Everything
    > works well as long as I provide a value for each variable
    > that places a value in one of the Access database
    > fields. For both the INSERT and UPDATE statements, I
    > would like to provide "real" values for some fields and
    > null values for the others. For example, I would like to
    > INSERT a new record with strings in some fields and null
    > values in others. Later, an UPDATE statement may place
    > values in some of the null fields and place no value in
    > the other null fields.
    >
    > I use two ASP pages: one for INSERT and one for UPDATE.
    > I would like to use one complete SQL statement in each
    > ASP page that specifies all fields. Then, I would
    > provide values for some fields and not others. In my
    > tests, I'm unable to do this. Is there a workaround?
    >
    > Thanks.
    >
    > Jim Bowman
    >


  • Next message: Greg: "Simple SQL query to return data to datagrid."