Click here to Skip to main content
15,885,842 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello,
I have a dbgrid connected to an sql server table with a bindingsource, the odd thing is that when I give value only to the first field (nvarchar) and do update it erases the value and leaves an empty record, when I give vaqlue to the first field and to the second or more (all other fields are date type) it accepts and record is proper.
code of update button
VB
Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click
        Me.CarBindingSource3.EndEdit()
        If DataSet11.HasChanges Then
            Try
                SqlDataAdapter1.Update(DataSet11, "car")
                DataSet11.AcceptChanges()
            Catch eUpdate As System.Exception
                Throw eUpdate
            End Try
        End If
    End Sub

All fields are set to allow nulls in sql and table has PK.
Any idea?

Thank you
Posted
Comments
Jim Jos 31-Jul-14 3:39am    
HOw can u have PK with Null option?
Member 3892343 1-Aug-14 3:42am    
pk is not null all other fields are, I have checked dbgrid too it is not read-only everything is correct, I thing is the code for the update button

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900