I would like to set up a DataColumn in my table of type Guid and a new
Guid(Guid.NewGuid) would be the expression that gets evaluated when ever a
new row was added. I have the DataSet bound to a grid so I would like to set
this up at compile time. The Guid DataColumn is also the primary key so it
has to be set when a row is added.

Thanks,
Marc

Re: DataColumn expression to create new Guid by Miha

Miha
Fri Oct 28 02:55:20 CDT 2005

Hi Marc,

You might use DataTable.RowChanged event?
Use this code, for example:
if (e.Action == DataRowAction.Add)
e.Row["Guid"] = Guid.NewGuid();

--
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

"Marc" <Marc@discussions.microsoft.com> wrote in message
news:FBBB3462-C2E7-4122-B71C-2030F0F160A4@microsoft.com...
>I would like to set up a DataColumn in my table of type Guid and a new
> Guid(Guid.NewGuid) would be the expression that gets evaluated when ever a
> new row was added. I have the DataSet bound to a grid so I would like to
> set
> this up at compile time. The Guid DataColumn is also the primary key so
> it
> has to be set when a row is added.
>
> Thanks,
> Marc



Re: DataColumn expression to create new Guid by Marc

Marc
Fri Oct 28 06:04:02 CDT 2005

Thanks,

Marc

"Miha Markic [MVP C#]" wrote:

> Hi Marc,
>
> You might use DataTable.RowChanged event?
> Use this code, for example:
> if (e.Action == DataRowAction.Add)
> e.Row["Guid"] = Guid.NewGuid();
>
> --
> Miha Markic [MVP C#]
> RightHand .NET consulting & development www.rthand.com
> Blog: http://cs.rthand.com/blogs/blog_with_righthand/
>
> "Marc" <Marc@discussions.microsoft.com> wrote in message
> news:FBBB3462-C2E7-4122-B71C-2030F0F160A4@microsoft.com...
> >I would like to set up a DataColumn in my table of type Guid and a new
> > Guid(Guid.NewGuid) would be the expression that gets evaluated when ever a
> > new row was added. I have the DataSet bound to a grid so I would like to
> > set
> > this up at compile time. The Guid DataColumn is also the primary key so
> > it
> > has to be set when a row is added.
> >
> > Thanks,
> > Marc
>
>
>