Main Page | Report this Page
.NET DotNet Forum Index  »  ADO .NET Forum  »  Added Unique Contraint by my DataGridView doesn't...
Page 1 of 1    

Added Unique Contraint by my DataGridView doesn't...

Author Message
Grant Schenck...
Posted: Thu Oct 08, 2009 4:51 pm
Guest
Hello,

Win Forms .NET 2.0, Visual Studio 2008.

I wanted to prevent users from adding the same string for a Name column. I
modified my SQLServer DB and using Management Studio Express I checked and
sure enough it prevents me from putting data in the field.

Now I go back to a Winforms app I'm writing to work with the DB and the
DataGridView associated with my DataTable still allows me to put in
duplicate values. Only when I go to update it fail. So how to I get Visual
Studio to reload the table definitions to get the code in the designer to
reflect the new constraint?

Thanks!
--
Grant Schenck
 
Miha Markic...
Posted: Fri Oct 09, 2009 1:53 am
Guest
Try removing the table from dataset and adding it again.

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: blog.rthand.com

"Grant Schenck" <schenckg at (no spam) optonline.net> wrote in message
news:ujC#unGSKHA.1372 at (no spam) TK2MSFTNGP02.phx.gbl...
Quote:
Hello,

Win Forms .NET 2.0, Visual Studio 2008.

I wanted to prevent users from adding the same string for a Name column.
I modified my SQLServer DB and using Management Studio Express I checked
and sure enough it prevents me from putting data in the field.

Now I go back to a Winforms app I'm writing to work with the DB and the
DataGridView associated with my DataTable still allows me to put in
duplicate values. Only when I go to update it fail. So how to I get
Visual Studio to reload the table definitions to get the code in the
designer to reflect the new constraint?

Thanks!
--
Grant Schenck


 
Grant Schenck...
Posted: Fri Oct 09, 2009 7:40 am
Guest
That seems like an overkill. Are you saying anytime I want to change some
aspect of my database I need to delete it, remove it from my project and
then recreate it and add it back? That means I have to recreate the table
schema and save off and re-import existing data!

I would assume there is some way to tell Visual Studio to regenerate the
table definitions...
--
Grant Schenck


"Miha Markic" <miha at rthand com> wrote in message
news:6BD81FB9-532E-4F2E-AE0D-DF8C40E1DE2E at (no spam) microsoft.com...
Quote:
Try removing the table from dataset and adding it again.

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: blog.rthand.com

"Grant Schenck" <schenckg at (no spam) optonline.net> wrote in message
news:ujC#unGSKHA.1372 at (no spam) TK2MSFTNGP02.phx.gbl...
Hello,

Win Forms .NET 2.0, Visual Studio 2008.

I wanted to prevent users from adding the same string for a Name column.
I modified my SQLServer DB and using Management Studio Express I checked
and sure enough it prevents me from putting data in the field.

Now I go back to a Winforms app I'm writing to work with the DB and the
DataGridView associated with my DataTable still allows me to put in
duplicate values. Only when I go to update it fail. So how to I get
Visual Studio to reload the table definitions to get the code in the
designer to reflect the new constraint?

Thanks!
--
Grant Schenck


 
Miha Markic...
Posted: Fri Oct 09, 2009 8:24 am
Guest
Hi Grant,

"Grant Schenck" <schenckg at (no spam) optonline.net> wrote in message
news:#crnBYOSKHA.3540 at (no spam) TK2MSFTNGP04.phx.gbl...
Quote:
That seems like an overkill. Are you saying anytime I want to change some
aspect of my database I need to delete it, remove it from my project and
then recreate it and add it back? That means I have to recreate the
table schema and save off and re-import existing data!

Not the database, the strong typed datasets. Open the dataset in the
designer, remove all tables (or all modified tables) and drag&drop them on
the dataset again.
I am assuming you have a strong typed datatable that is hosted within a
strong typed dataset?
If not, where/how do you get your DataTable from?

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: blog.rthand.com

Quote:

I would assume there is some way to tell Visual Studio to regenerate the
table definitions...
--
Grant Schenck


"Miha Markic" <miha at rthand com> wrote in message
news:6BD81FB9-532E-4F2E-AE0D-DF8C40E1DE2E at (no spam) microsoft.com...
Try removing the table from dataset and adding it again.

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: blog.rthand.com

"Grant Schenck" <schenckg at (no spam) optonline.net> wrote in message
news:ujC#unGSKHA.1372 at (no spam) TK2MSFTNGP02.phx.gbl...
Hello,

Win Forms .NET 2.0, Visual Studio 2008.

I wanted to prevent users from adding the same string for a Name column.
I modified my SQLServer DB and using Management Studio Express I checked
and sure enough it prevents me from putting data in the field.

Now I go back to a Winforms app I'm writing to work with the DB and the
DataGridView associated with my DataTable still allows me to put in
duplicate values. Only when I go to update it fail. So how to I get
Visual Studio to reload the table definitions to get the code in the
designer to reflect the new constraint?

Thanks!
--
Grant Schenck




 
Grant Schenck...
Posted: Fri Oct 09, 2009 4:16 pm
Guest
Got it! I'll give that a try.

Thanks to you both.

Regards,
--
Grant Schenck


"Miha Markic" <miha at rthand com> wrote in message
news:B93788E4-7B7C-4403-9E3B-1B1E86BBEB9C at (no spam) microsoft.com...
Quote:
Hi Grant,

"Grant Schenck" <schenckg at (no spam) optonline.net> wrote in message
news:#crnBYOSKHA.3540 at (no spam) TK2MSFTNGP04.phx.gbl...
That seems like an overkill. Are you saying anytime I want to change
some aspect of my database I need to delete it, remove it from my project
and then recreate it and add it back? That means I have to recreate the
table schema and save off and re-import existing data!

Not the database, the strong typed datasets. Open the dataset in the
designer, remove all tables (or all modified tables) and drag&drop them on
the dataset again.
I am assuming you have a strong typed datatable that is hosted within a
strong typed dataset?
If not, where/how do you get your DataTable from?

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: blog.rthand.com


I would assume there is some way to tell Visual Studio to regenerate the
table definitions...
--
Grant Schenck


"Miha Markic" <miha at rthand com> wrote in message
news:6BD81FB9-532E-4F2E-AE0D-DF8C40E1DE2E at (no spam) microsoft.com...
Try removing the table from dataset and adding it again.

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: blog.rthand.com

"Grant Schenck" <schenckg at (no spam) optonline.net> wrote in message
news:ujC#unGSKHA.1372 at (no spam) TK2MSFTNGP02.phx.gbl...
Hello,

Win Forms .NET 2.0, Visual Studio 2008.

I wanted to prevent users from adding the same string for a Name
column. I modified my SQLServer DB and using Management Studio Express
I checked and sure enough it prevents me from putting data in the
field.

Now I go back to a Winforms app I'm writing to work with the DB and the
DataGridView associated with my DataTable still allows me to put in
duplicate values. Only when I go to update it fail. So how to I get
Visual Studio to reload the table definitions to get the code in the
designer to reflect the new constraint?

Thanks!
--
Grant Schenck




 
 
Page 1 of 1    
All times are GMT - 5 Hours
The time now is Fri Nov 27, 2009 4:36 pm