A
Asfar
I am having problem inserting rows in a table with identity column.
One columen is an Id field with identity set to true.
I insert values into the other column and the column with identity set
to true is updated with correct new values.
From the SQl query analyzer if i check the value of @@Identity it has
null value.
I use Select @@Identity from Test1
When i add values from query analyzer @@Identity has correct values.
Here is the simple code that I am trying out.
SqlCommand objCmd = new SqlCommand("INSERT INTO Test1(DEST) VALUES
('Test2')", objConn);
objConn.Open();
objCmd.ExecuteNonQuery();
objConn.Close();
Anyone has ideas as to what the problem might be.
Thanks,
-Asfar
One columen is an Id field with identity set to true.
I insert values into the other column and the column with identity set
to true is updated with correct new values.
From the SQl query analyzer if i check the value of @@Identity it has
null value.
I use Select @@Identity from Test1
When i add values from query analyzer @@Identity has correct values.
Here is the simple code that I am trying out.
SqlCommand objCmd = new SqlCommand("INSERT INTO Test1(DEST) VALUES
('Test2')", objConn);
objConn.Open();
objCmd.ExecuteNonQuery();
objConn.Close();
Anyone has ideas as to what the problem might be.
Thanks,
-Asfar