PC Review


Reply
Thread Tools Rate Thread

Added Unique Contraint by my DataGridView doesn't seem to know about it...

 
 
Grant Schenck
Guest
Posts: n/a
 
      8th Oct 2009
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



 
Reply With Quote
 
 
 
 
Miha Markic
Guest
Posts: n/a
 
      9th Oct 2009
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" <(E-Mail Removed)> wrote in message
news:ujC#(E-Mail Removed)...
> 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
>
>
>

 
Reply With Quote
 
Grant Schenck
Guest
Posts: n/a
 
      9th Oct 2009
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-(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:ujC#(E-Mail Removed)...
>> 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
>>
>>
>>



 
Reply With Quote
 
Miha Markic
Guest
Posts: n/a
 
      9th Oct 2009
Hi Grant,

"Grant Schenck" <(E-Mail Removed)> wrote in message
news:#(E-Mail Removed)...
> 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-(E-Mail Removed)...
>> 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" <(E-Mail Removed)> wrote in message
>> news:ujC#(E-Mail Removed)...
>>> 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
>>>
>>>
>>>

>
>

 
Reply With Quote
 
Grant Schenck
Guest
Posts: n/a
 
      9th Oct 2009
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-(E-Mail Removed)...
> Hi Grant,
>
> "Grant Schenck" <(E-Mail Removed)> wrote in message
> news:#(E-Mail Removed)...
>> 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-(E-Mail Removed)...
>>> 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" <(E-Mail Removed)> wrote in message
>>> news:ujC#(E-Mail Removed)...
>>>> 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
>>>>
>>>>
>>>>

>>
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
new rows are added to top of DataGridView craig.wenger@gmail.com Microsoft C# .NET 4 27th Mar 2007 04:25 AM
Unique contraint requirement for typed dataset relations =?Utf-8?B?SGFycnkgS2Vjaw==?= Microsoft Dot NET Framework 0 29th Sep 2005 07:51 PM
how come user control added to page doesn't get added to codebehind file? Bennett Haselton Microsoft ASP .NET 1 8th Nov 2004 09:26 PM
Strange behavior:unique user getting message cannot logon interactively;added user to local group and it doesn't work Marlon Brown Microsoft Windows 2000 Active Directory 1 29th Oct 2004 12:30 AM
Handle Unique Contraint During Buld Inserts EWill Microsoft Excel Programming 2 29th Mar 2004 06:21 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:06 AM.