Can anyone hlp me here;
i have a form like this:
on the menu strip i have NEW and under new i have customers and what i want is when the user click on customers i want a empty customer GUI where the user can enter a new customer
Here's what i have done:
Private Sub CustomerToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CustomerToolStripMenuItem1.Click
Dim DBCon As New SqlClient.SqlConnection(My.Settings.NewEvapcoDBConnectionString.ToString())
Dim inc As Integer
If inc <> -1 Then
Dim dsNewRow As DataRow
Dim ds As New CustomerDataSet
dsNewRow = ds.Tables("Customers").NewRow
dsNewRow.Item("CompanyName") = CustomerForm.CompanyNameTextBox.Text
dsNewRow.Item("OldName") = CustomerForm.OldNameTextBox.Text
dsNewRow.Item("PostalAddress") = CustomerForm.PostalAddressTextBox.Text
dsNewRow.Item("Pocity") = CustomerForm.PoCityTextBox.Text
dsNewRow.Item("PoPostalCode") = CustomerForm.PoPostalCodeTextBox.Text
dsNewRow.Item("PhysicalAddress") = CustomerForm.PhysicalAddressTextBox.Text
dsNewRow.Item("PhCity") = CustomerForm.PhysicalAddressTextBox.Text
dsNewRow.Item("PhPostalCode") = CustomerForm.PhPostalCodeTextBox.Text
dsNewRow.Item("Telephone") = CustomerForm.TelephoneTextBox.Text
dsNewRow.Item("FaxNumber") = CustomerForm.FaxNumberTextBox.Text
dsNewRow.Item("EmailAddress") = CustomerForm.EmailAddressTextBox.Text
dsNewRow.Item("WebSite") = CustomerForm.WebSiteTextBox.Text
' dsNewRow.Item("LastTransaction") = CustomerForm.LastTransactionDateTimePicker
dsNewRow.Item("DebtorsAccountNumber") = CustomerForm.DebtorsAccountNumberTextBox.Text
dsNewRow.Item("Discount") = CustomerForm.DiscountTextBox.Text
dsNewRow.Item("VATNo") = CustomerForm.VATNoTextBox.Text
dsNewRow.Item("Bank") = CustomerForm.BankTextBox.Text
dsNewRow.Item("Branch") = CustomerForm.BranchTextBox.Text
dsNewRow.Item("BranchCode") = CustomerForm.BranchCodeTextBox.Text
dsNewRow.Item("AccountNo") = CustomerForm.AccountNoTextBox.Text
dsNewRow.Item("BEEStatus") = CustomerForm.BEEStatusTextBox.Text
dsNewRow.Item("PaymentTerms") = CustomerForm.PaymentTermsTextBox.Text
ds.Tables("Customers").Rows.Add(dsNewRow)
End If
End Sub
and i am getting an error saying customerID (PK) cannot allow null, how can i bypass that

New Topic/Question
Reply



MultiQuote



|