Showing posts with label integer. Show all posts
Showing posts with label integer. Show all posts

Monday, March 19, 2012

How to set up auto incrementing for a field

I have a database table. I need to set a particular data field to allow for Auto Incrementing. Basically I need to set up the initial integer value to start at. Then to specify the amount to increment by.

What I have done so far is to right click on the field name in SQL Server 2005. Then, on the pop-up menu I select the menu option for properties.

When the properties are displayed I see some fields listed in dark grey but I am not able to edit these fields. In other words, if I try to type text in this field, nothing happens. The fields I am talking about are:

Identity Increment

Identity Seed

Is Identity

Does anyone know what the problem is? What do I have to do to edit these fields.

Check if you have the necessary permissions.|||You can not change the properties directly in the Column Properties window, instead, you can right click the column and choose 'Modify'. Enjoy itSmile

Wednesday, March 7, 2012

how to set integer value in buffer

I am trying to set a decimal value to the pipelinecolumn buffer, but it doesnt get set, and the value is NULL.

Here is the portion of the code of what I am trying to do:

if (columnInfos[x].colName.EndsWith("_CRC"))

{

int a;

a_cmp tst = new a_cmp();

a= tst.a_crc32(inputbufferstream); this function returns a integer value

buffer.SetDecimal(colInfo.bufferColumnIndex, Convert.ToDecimal(a));

}

Please let me know how to set a decimal value in the buffer.

That line of code looks correct, assuming the bufferColumnIndex is correct and the column is of type DT_CY, DT_DECIMAL, or DT_NUMERIC.

Are you seeing an exception?

Thanks
Mark

|||

Do you want to set an integer or do you wanta decimal. Subject says one thing, text says another.

An agnostic way of doing this is to just assign direct, e.g.

buffer[colInfo.bufferColumnIndex] = a;