A
Alex
I'm still having problems inserting a row into a table with a column with
the uniqueidentifier datatype.
I'm having no problems autoincrementing using datatypes like integer.
Here is my table that I created with VS2003.NET using the server explorer
tools.
myTable
col1: (primary key) - char (length 40) - not allowing null
col2: uniqueidentifier - not allowing null
Description: ""
Default Value: (newid())
Is RowGuid: Yes
Formula: ""
-> all other fields are grayed out; this includes the autoincrement
fields
Here is the code that I'm using to add a row:
DataSet myDataSet= new DataSet();
myAdapter.Fill(myDataSet, "myTable");
DataRow newDataRow= myDataSet.Tables["myTable"].NewRow();
newDataRow["col1"] = "Hello";
myDataSet.Tables["myTable"].Rows.Add(newDataRow);
myAdapter.Update(myDataSet,"myTable");
This results with the exception that the col1 value can't be NULL.
Of course if I change the column to allow null, I can add the row, resulting
in a row entry with no GUID.
If I add a line like newDataRow["col2"] = System.NewGUID(); I get it to
work.
I'm still looking for a way to add a new row using uinqueidentifier without
the new to specify the GUID in the client.
Please note that the autoincrement fields are grayed out in the designer for
this type. The fields can't be modified in the client code.
Alex
the uniqueidentifier datatype.
I'm having no problems autoincrementing using datatypes like integer.
Here is my table that I created with VS2003.NET using the server explorer
tools.
myTable
col1: (primary key) - char (length 40) - not allowing null
col2: uniqueidentifier - not allowing null
Description: ""
Default Value: (newid())
Is RowGuid: Yes
Formula: ""
-> all other fields are grayed out; this includes the autoincrement
fields
Here is the code that I'm using to add a row:
DataSet myDataSet= new DataSet();
myAdapter.Fill(myDataSet, "myTable");
DataRow newDataRow= myDataSet.Tables["myTable"].NewRow();
newDataRow["col1"] = "Hello";
myDataSet.Tables["myTable"].Rows.Add(newDataRow);
myAdapter.Update(myDataSet,"myTable");
This results with the exception that the col1 value can't be NULL.
Of course if I change the column to allow null, I can add the row, resulting
in a row entry with no GUID.
If I add a line like newDataRow["col2"] = System.NewGUID(); I get it to
work.
I'm still looking for a way to add a new row using uinqueidentifier without
the new to specify the GUID in the client.
Please note that the autoincrement fields are grayed out in the designer for
this type. The fields can't be modified in the client code.
Alex