473,385 Members | 2,162 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

PasswordHash NULL problem

When I try to save a new (inserted) record in an SQL database, I get the following System.Runtime.InteropServices.ExternalException 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.
I have to either find out how to insert an appropriate value into the PasswordHash column OR make SQL Server Management Studio allow NULL in the PasswordHash column.

I discovered I could do the latter in SQL Server Management Studio via:

expand table | expand Columns | right-click PasswordHash column | click Modify | in lower right frame: toggle Allow Nulls from No to Yes

On doing so and then attempting to exit SQL Server Management Studio, I got a dialog box saying:

Save changes to the following items?
SQL Server Objects
<Server name>.AdventureWorks - Person.Contact
Clicking Yes elicited the following message:

Saving changes is not permitted. The changes you have made require the following tables to be dropped and re-created. You have either made changes to a table that can't be re-created or enabled the option Prevent saving changes that require the table to be re-created.

Contact (Person)
SQL Server Management Studio's onboard Help says I can override the "Prevent saving changes that require the table to be re-created" setting via:

Tools | Options | Designers | Table and Database Designers | Prevent saving changes that require table re-creation

I can try this, but I wonder if it might be dangerous. If for whatever reason the table can't be re-created, could I possibly destroy the original table in the process and then have to reinstall the AdventureWorks database? I don't want to have to do that, since for some unknown reason I had a very difficult time installing it the first time.

And ultimately, I don't want to sacrifice encryption, as I suspect might be the case if I allowed PasswordHash to be NULL.

So here are my two questions:
1. Could it be dangerous to try to re-create the table?
2. How do I get an appropriate value to put in the PasswordHash column?

For what it's worth, I'm working in a 32-bit environment with the following software:

SQL Server 2008 Express with Advanced Services
database: SQL2008 AdventureWorks (schema.table: Person.Contact)
SQL Server 2008 Management Studio Express
Visual C# 2008 Express
Mar 28 '09 #1
6 3001
ck9663
2,878 Expert 2GB
These tables are usually related to one another. There are referential and domain integrity checks within the tables across the database. Although you might be able to change some of these, some of the relationships and checks might be broken because of your update.That's why it's not uncommon for sample data to be read-only.

If you're trying to create sample applications, you might just want to create a new database and table to work on.

--- CK
Mar 28 '09 #2
ck9663:

Maybe the exact things I've proposed doing might break something, but the objective I'm pursuing is just to make the data NOT read-only, how ever that might appropriately be accomplished. Yes, the table I'm working with is related to other tables, but that's just about always the case with "real" (non-sample) databases, and they're successfully updated all the time. Surely I don't need to type in a whole new database just to accomplish that.
Mar 28 '09 #3
ck9663:

But I would actually prefer just to supply values for the PasswordHash column, if I could figure out how to do that. You wouldn't by any chance know how, would you?
Mar 28 '09 #4
ck9663
2,878 Expert 2GB
We don't know what the column is used for. I assume it's a password that's encrypted using the one-way hash technique. You can store space if you want to, but an application that reads that field will decrypt it and will not be able to use your field.


--- CK
Mar 29 '09 #5
ck9663:

These tables are usually related to one another. There are referential and domain integrity checks within the tables across the database. Although you might be able to change some of these, some of the relationships and checks might be broken because of your update.
Yeah, but wouldn't a password hash be only for applications that require passwords? All I want MY application to do is to edit, insert and delete records. It won't require any passwords. Do you think it's at all likely that relationships between tables could be compromised? I mean, maybe they could, I don't know, I'm asking you.

We don't know what the column is used for.
It's very odd. Every single record has a different hash and therefore a different password. I don't get it.

I assume it's a password that's encrypted using the one-way hash technique.
Agreed.

You can store space if you want to...
What do you mean by "store space"?

...an application that reads that field will decrypt it...
I don't think so. A hash should be easy to obtain from the text that you're encrypting (in this case, the password), but "extremely difficult" (read that as "virtually impossible") to decrypt back into the password.

...and will not be able to use your field.
I'm sorry, I don't understand what you're saying.
Mar 30 '09 #6
ck9663
2,878 Expert 2GB
Store space.

Expand|Select|Wrap|Line Numbers
  1.  
  2. INSERT INTO table (column1) values (' ')
  3.  
  4.  
--- CK
Mar 30 '09 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Sascha | last post by:
Hi I need some help on achieving the following: I wrote a querie which collects Data out of three Tables, the Result looks like this: SET NOCOUNT ON DECLARE @ROW INT
4
by: James Fisher | last post by:
How are people handling NULL values for value types. Descriptions of problem Say you have a typical method with the signature: public int InsertPerson(string firstName, string lastName, int...
5
by: David Sworder | last post by:
Hi, I've created a UserControl-derived class called MyUserControl that is able to persist and subsequently reload its state. It exposes two methods as follows: public void Serialize(Stream...
17
by: John | last post by:
Hi I have a datadapter with the following SQL; SELECT ID, Company, Status, CompanyType FROM Companies WHERE (@Status IS NULL or @Status = Status) When I try to fill like...
27
by: David W | last post by:
I'm almost tearing my hair out. A colleague claimed that a null reference can exist, like this: void f( int& p ) { printf( "%d\n", p ); } int main (int argc, char *argv) {
3
by: Jon L | last post by:
Hi, I'm hoping someone can help me with this problem. I'm not sure whether the problem lies with the software or with my understanding of the language. I'm using the Microsoft.XMLDOM object...
8
by: A. Anderson | last post by:
Howdy everyone, I'm experiencing a problem with a program that I'm developing. Take a look at this stack report from GDB - #0 0xb7d782a3 in strlen () from /lib/tls/i686/cmov/libc.so.6 #1 ...
0
by: BobLewiston | last post by:
When I try to save a new (inserted) record via the following code: DataRow row = dataTable.Rows ; // update data in DataSet from data entry WinForm row.BeginEdit (); row = txtTitle.Text;...
2
by: BobLewiston | last post by:
Some of you may have seen my earlier thread “PasswordHash NULL problem”. I’ve started a new thread because investigation has shown that the problem is actually quite different than I previously...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.