webForumDet fria alternativet

Få fram placering

.NET

2 svar · 203 visningar · startad av andreas_lindh

Medlem sedan jan. 20011 140 inlägg
Frågan#1

Jag har en datagrid där jag skriver ut en hockeytabell.

Nu vill jag skriva ut vilken placering laget har.
Går det att lägga till en column i datagriden som skriver ut placeringen?

Medlem sedan sep. 20011 914 inlägg
#2

.NET Framework SDK documentation skrev:

To ensure that the values in a column are unique, you can set the column values to increment automatically when new rows are added to the table. To create an auto-incrementing DataColumn, set the AutoIncrement property of the column to true. The DataColumn will then start with the value defined in the AutoIncrementSeed property, and with each row added the value of the AutoIncrement column will increase by the value held in the AutoIncrementStep property of the column.

For AutoIncrement columns, it is recommended that the ReadOnly property of the DataColumn be set to true.

The following example demonstrates how to create a column that starts with a value of 200 and adds incrementally in steps of three.

Dim workColumn As DataColumn = workTable.Columns.Add("CustomerID", typeof(Int32))
workColumn.AutoIncrement = true
workColumn.AutoIncrementSeed = 200
workColumn.AutoIncrementStep = 3

Medlem sedan jan. 20011 140 inlägg
#3

jag testade med det här

Dim workColumn As DataColumn = workTable.Columns.Add("placering", typeof(Int32)) 
workColumn.AutoIncrement = true 
workColumn.AutoIncrementSeed = 1 
workColumn.AutoIncrementStep = 1

Den klagar på den sista ).
d:\inetpub\wwwroot\tibroik.net\atabell.ascx.vb(43): 'Is' expected.

261 ms totalt · 4 externa anrop · v20260731065814-full.a51de22e
121 ms — deklarationer (db)
0 ms — hämta statistik (cache)
136 ms — hämta tråd, inlägg och bilagor (db)
122 ms — ändringar (db)