Go Back   Computer Forums > General Computing > Programming
Click Here to Login
Join Computer forums Today

Thread Tools Search this Thread Display Modes
Old 03-27-2009, 06:32 PM   #1
Baseband Member
Join Date: Nov 2008
Posts: 91
Default How do I get PasswordHash value?

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 ();

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:

SQL Server 2008 Express with Advanced Services
database:SQL2008 AdventureWorks (schema.table: Person.Contact)
SQL Server 2008 Management Studio Express
Visual C# 2008 Express

BobLewiston is offline   Reply With Quote
Old 06-28-2009, 07:47 PM   #2
Baseband Member
Join Date: Jun 2009
Posts: 36
Default Re: How do I get PasswordHash value?

Is the user required to enter a password for the current record? If so, just hash the value, I would recommend one of the SHA hashes, and store it in that column as you did the other fields.
dmarciano is offline   Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

All times are GMT -5. The time now is 08:14 AM.

Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0