Answer the question
In order to leave comments, you need to log in
Values are not added to the database through the bindingsource, what should I do?
Hello. When adding data to the Person table, the following error occurs : "Unhandled exception of type 'System.Data.NoNullAllowedException' in System.Data.dll
Additional information: Column 'p_name' does not allow values equal to nulls." .
It seems that an empty value is added to the datagridview in the "p_name" field. I don't know how to fix this.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace CRUID_Bank
{
public partial class AddPerson : Form
{
public AddPerson()
{
InitializeComponent();
}
private void AddPerson_Load(object sender, EventArgs e)
{
// TODO: данная строка кода позволяет загрузить данные в таблицу "bankDataSet.Person". При необходимости она может быть перемещена или удалена.
this.personTableAdapter.Fill(this.bankDataSet.Person);
personBindingSource.DataSource = this.bankDataSet.Person;
}
private void button_Next_Click(object sender, EventArgs e)
{
this.bankDataSet.Person.AddPersonRow(bankDataSet.Person.NewPersonRow());
personBindingSource.MoveLast();
}
}
}
Answer the question
In order to leave comments, you need to log in
Look at what you are passing to row. Most likely, when sending data to a method, you are not passing empty values.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question