CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Thread: NULL Value

Threaded View

  1. #1
    Join Date
    Feb 2009
    Posts
    192

    NULL Value

    Hi,

    I have the follwoing code;

    Code:
    query = "INSERT INTO dbo.TblPracExclude (prac_no, Goldpracid) VALUES (" & _
                                                          chk_prac_no & ", '" & _
                                                          DgvPracExcl.Rows(RowID).Cells(1).Value  & "')"
    
                                    cmd = New SqlCommand(query, conn1)
                                    cmd.ExecuteNonQuery()
    I am trying to add these values to a table in SQL database.

    The problem am facing is that DgvPracExcl.Rows(RowID).Cells(1).Value is empty so this inserts an empty string to the database.
    Instead I want it to insert a NULL value.

    Is this possisble?

    Thanks
    Last edited by dr223; August 10th, 2012 at 09:46 AM.

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

Featured