thedougster
Programmer
When I try to save a new (inserted) record via the following code:
DataRow row = dataTable.Rows [currRec];
// update data in DataSet from data entry WinForm
row.BeginEdit ();
row ["Title"] = txtTitle.Text;
row ["FirstName"] = txtFirstName.Text;
row ["MiddleName"] = txtMiddleName.Text;
row ["LastName"] = txtLastName.Text;
row ["Suffix"] = txtSuffix.Text;
row ["Phone"] = txtPhone.Text;
row ["EmailAddress"] = txtEmailAddress.Text;
row.EndEdit ();
try
{
dataAdapter.Update (dataSet, "Person.Contact");
}
catch (System.Runtime.InteropServices.ExternalException exc)
{
MessageBox.Show (exc.Message);
}
I get the following exception message:
Cannot insert the value NULL into column 'PasswordHash', table 'AdventureWorks.Person.Contact'; column does not allow nulls. INSERT fails. The statement has been terminated.
How do I get an appropriate PasswordHash value that I can put it in the newly-created record I'm inserting into the database?
For what it’s worth, the environment I’m working in is:
32-bit
SQL Server 2008 Express with Advanced Services
database:SQL2008 AdventureWorks (schema.table: Person.Contact)
SQL Server 2008 Management Studio Express
Visual C# 2008 Express
DataRow row = dataTable.Rows [currRec];
// update data in DataSet from data entry WinForm
row.BeginEdit ();
row ["Title"] = txtTitle.Text;
row ["FirstName"] = txtFirstName.Text;
row ["MiddleName"] = txtMiddleName.Text;
row ["LastName"] = txtLastName.Text;
row ["Suffix"] = txtSuffix.Text;
row ["Phone"] = txtPhone.Text;
row ["EmailAddress"] = txtEmailAddress.Text;
row.EndEdit ();
try
{
dataAdapter.Update (dataSet, "Person.Contact");
}
catch (System.Runtime.InteropServices.ExternalException exc)
{
MessageBox.Show (exc.Message);
}
I get the following exception message:
Cannot insert the value NULL into column 'PasswordHash', table 'AdventureWorks.Person.Contact'; column does not allow nulls. INSERT fails. The statement has been terminated.
How do I get an appropriate PasswordHash value that I can put it in the newly-created record I'm inserting into the database?
For what it’s worth, the environment I’m working in is:
32-bit
SQL Server 2008 Express with Advanced Services
database:SQL2008 AdventureWorks (schema.table: Person.Contact)
SQL Server 2008 Management Studio Express
Visual C# 2008 Express