473,387 Members | 1,379 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Identiy Columns

Hi, I know how to get table columns with getoledbschematable and how to get the columns and type for a specific table but i need to know if a column have a identity type (incremental) please how can i get this information

---
Posted using Wimdows.net NntpNews Component - Posted from .NET's Largest Community Website: http://www.dotnetjunkies.com/newsgroups/
Jul 21 '05 #1
4 2580
Hi,

This is tricky, as it depends on provider:
for sqlserver it seems that column_flags = 16 and data_type=3 indicates
autonumbering
while for oledb/jet4 it seems that column_flags=90 and data_type=3 indicates
autonumbering

--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com

"dhernando" <dhernando@-NOSPAM-itecperu.com> wrote in message
news:eB**************@tk2msftngp13.phx.gbl...
Hi, I know how to get table columns with getoledbschematable and how to get the columns and type for a specific table but i need to know if a column
have a identity type (incremental) please how can i get this information
---
Posted using Wimdows.net NntpNews Component - Posted from .NET's Largest

Community Website: http://www.dotnetjunkies.com/newsgroups/
Jul 21 '05 #2
Hi,

This is tricky, as it depends on provider:
for sqlserver it seems that column_flags = 16 and data_type=3 indicates
autonumbering
while for oledb/jet4 it seems that column_flags=90 and data_type=3 indicates
autonumbering

--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com

"dhernando" <dhernando@-NOSPAM-itecperu.com> wrote in message
news:eB**************@tk2msftngp13.phx.gbl...
Hi, I know how to get table columns with getoledbschematable and how to get the columns and type for a specific table but i need to know if a column
have a identity type (incremental) please how can i get this information
---
Posted using Wimdows.net NntpNews Component - Posted from .NET's Largest

Community Website: http://www.dotnetjunkies.com/newsgroups/
Jul 21 '05 #3
There is another way but it is slower than what Miha has suggested.

DataAdatper has a method called FillSchema. Call this method and then
examine the DataColumn elements of the Table. DataColumn has Properties

1. AutoIncrement 2) AutoIncrementSeed 3) AutoIncrementStep
Jul 21 '05 #4
Thank you for help me, look i have this procedure, look in the last case "isautoincrement" looks ok but is not working everything else work fine please maybe you can see where is the error thanks a lot

cmd.CommandText = "SELECT * FROM " + tblName
cmd.Connection = cnn
myReader = cmd.ExecuteReader()
schemaTable = myReader.GetSchemaTable()
i=0
foreach (DataRow myField in schemaTable.Rows

foreach (DataColumn myProperty in schemaTable.Columns)

switch (myProperty.ColumnName.ToLower())

case "columnname"
listView1.Items.Add (myField[myProperty].ToString())
break
case "columnsize"
listView1.Items[i].SubItems.Add(myField[myProperty].ToString())
break
case "datatype"
listView1.Items[i].SubItems.Add(myField[myProperty].ToString())
break
case "isautoincrement"
listView1.Items[i].SubItems.Add(myField[myProperty].ToString())
break
i++
}

---
Posted using Wimdows.net NntpNews Component - Posted from .NET's Largest Community Website: http://www.dotnetjunkies.com/newsgroups/
Jul 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: dhernando | last post by:
Hi, I know how to get table columns with getoledbschematable and how to get the columns and type for a specific table but i need to know if a column have a identity type (incremental) please how can...
10
by: VA | last post by:
I got the following function to swap table columns from somewhere on the Internet function swapColumns (table, colIndex1, colIndex2) { if (table && table.rows && table.insertBefore && colIndex1...
2
by: Kevin | last post by:
Hi Al Can someone tell me how to hide colums in a datagrid. I have a one datagrid that is a master and child and I would like to hide specific columns, how do I do this TI Kevin
1
by: Amber | last post by:
The DataGrid allows you to make columns visible or invisible on demand - even edit and other special columns. This article will show you how it is done. Some developers have reported problems...
2
by: CSL | last post by:
I am using the DataGrid in a Windows Application, how can I adjust the widths of each column individually.
13
by: scorpion53061 | last post by:
Very urgent and I am very close but need a little help to get me over the edge........ I need to write these columns to a html file with each row containing these columns (seperated by breaks)....
5
by: Gary Blakely | last post by:
I'm giving this post another try - it can't be too difficult for everyone.... In the program below, the web page has dataGrid1. the only thing that has been done to it at design time is to...
1
by: thomasp | last post by:
Will someone tell me why with the following code: 1. The user can not resize the columns 2. The DTG column is not formatted as "dd-MMM-yy HH:mm:ss" 3. The user can modify the data in all...
0
by: bappelsin | last post by:
Hello, I have a problem with the datagridview. I have a view with around 25 different columns. To make life easier for the users I have implemented a popup dialog where the user can select which...
5
by: explode | last post by:
I made a procedure Public Sub Novo(ByVal nova1 As String, ByVal nova2 As String) that creates a new oledbDataAdapter with insert update select and delete commads. I also added that commands can...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.