473,398 Members | 2,088 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,398 software developers and data experts.

Determining Sql Column name?


The code below will correctly locate the last entry in a particular SQL Table in VWeb 2005 with VB.

How can I determine the column name associated with the column number x?

Dim tempA As System.Data.DataView
tempA = GetPriorAnswers()
Dim x As Integer
Dim temp As Integer = Session("Pointer")
For i As Integer = 1 To 10000
x = temp - i
If Len(tempA.Item(0)(x).ToString) 0 Then
Exit For
End If
Next
<at this point, x is the column number for the last entry in the table - what code will return the column name?>

Thanks in advance

Jeff


--
Posted via a free Usenet account from http://www.teranews.com

Sep 18 '06 #1
6 4044
Check out http://support.sas.com/ctx/samples/index.jsp?sid=817
About midway down it talks about using the schema data to retrieve this
(with ADO.Net)

Thanks,

Seth Rowe

Jeff wrote:
The code below will correctly locate the last entry in a particular SQL Table in VWeb 2005 with VB.

How can I determine the column name associated with the column number x?

Dim tempA As System.Data.DataView
tempA = GetPriorAnswers()
Dim x As Integer
Dim temp As Integer = Session("Pointer")
For i As Integer = 1 To 10000
x = temp - i
If Len(tempA.Item(0)(x).ToString) 0 Then
Exit For
End If
Next
<at this point, x is the column number for the last entry in the table - what code will return the column name?>

Thanks in advance

Jeff


--
Posted via a free Usenet account from http://www.teranews.com
Sep 18 '06 #2
Jeff,

http://msdn.microsoft.com/library/de...tabletopic.asp

dim dcname as string = TempA.ToTable.DataColumns(x).Columnname

http://msdn.microsoft.com/library/de...nnametopic.asp

I hope this helps,

Cor

"Jeff" <no**@none.comschreef in bericht
news:45***********************@free.teranews.com.. .
>
The code below will correctly locate the last entry in a particular SQL
Table in VWeb 2005 with VB.

How can I determine the column name associated with the column number x?

Dim tempA As System.Data.DataView
tempA = GetPriorAnswers()
Dim x As Integer
Dim temp As Integer = Session("Pointer")
For i As Integer = 1 To 10000
x = temp - i
If Len(tempA.Item(0)(x).ToString) 0 Then
Exit For
End If
Next
<at this point, x is the column number for the last entry in the table -
what code will return the column name?>

Thanks in advance

Jeff


--
Posted via a free Usenet account from http://www.teranews.com

Sep 18 '06 #3
Sorry, guess I read your post wrong (got thrown off by the post title)
- I thought you were looking for the column name of a SQL Server table.

Thanks,

Seth Rowe

Cor Ligthert [MVP] wrote:
Jeff,

http://msdn.microsoft.com/library/de...tabletopic.asp

dim dcname as string = TempA.ToTable.DataColumns(x).Columnname

http://msdn.microsoft.com/library/de...nnametopic.asp

I hope this helps,

Cor

"Jeff" <no**@none.comschreef in bericht
news:45***********************@free.teranews.com.. .

The code below will correctly locate the last entry in a particular SQL
Table in VWeb 2005 with VB.

How can I determine the column name associated with the column number x?

Dim tempA As System.Data.DataView
tempA = GetPriorAnswers()
Dim x As Integer
Dim temp As Integer = Session("Pointer")
For i As Integer = 1 To 10000
x = temp - i
If Len(tempA.Item(0)(x).ToString) 0 Then
Exit For
End If
Next
<at this point, x is the column number for the last entry in the table -
what code will return the column name?>

Thanks in advance

Jeff


--
Posted via a free Usenet account from http://www.teranews.com
Sep 18 '06 #4
Jeff,

You are right if the select is renaming the table names, as long as that is
not done, this is correct.

Another way is using this.

http://www.vb-tips.com/dbpages.aspx?...c-e9d7983c1e05

I hope this helps,

Cor

"rowe_newsgroups" <ro********@yahoo.comschreef in bericht
news:11**********************@e3g2000cwe.googlegro ups.com...
Sorry, guess I read your post wrong (got thrown off by the post title)
- I thought you were looking for the column name of a SQL Server table.

Thanks,

Seth Rowe

Cor Ligthert [MVP] wrote:
>Jeff,

http://msdn.microsoft.com/library/de...tabletopic.asp

dim dcname as string = TempA.ToTable.DataColumns(x).Columnname

http://msdn.microsoft.com/library/de...nnametopic.asp

I hope this helps,

Cor

"Jeff" <no**@none.comschreef in bericht
news:45***********************@free.teranews.com. ..
>
The code below will correctly locate the last entry in a particular SQL
Table in VWeb 2005 with VB.

How can I determine the column name associated with the column number
x?

Dim tempA As System.Data.DataView
tempA = GetPriorAnswers()
Dim x As Integer
Dim temp As Integer = Session("Pointer")
For i As Integer = 1 To 10000
x = temp - i
If Len(tempA.Item(0)(x).ToString) 0 Then
Exit For
End If
Next
<at this point, x is the column number for the last entry in the
table -
what code will return the column name?>

Thanks in advance

Jeff


--
Posted via a free Usenet account from http://www.teranews.com

Sep 18 '06 #5

The "DataColumns" part of your syntax didn't work, but the following minor modification did.
ColName = tempA.ToTable.Columns(x).ColumnName()

Thanks. ...not sure why the original didn't work, but perhaps related to something I would need to import first?

Jeff
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message news:%2****************@TK2MSFTNGP02.phx.gbl...
Jeff,

http://msdn.microsoft.com/library/de...tabletopic.asp

dim dcname as string = TempA.ToTable.DataColumns(x).Columnname

http://msdn.microsoft.com/library/de...nnametopic.asp

I hope this helps,

Cor


--
Posted via a free Usenet account from http://www.teranews.com

Sep 18 '06 #6
Jeff,

This works however I made a mistake while typing, now you are copying the
table first my intention was

ColName = tempA.Table.Columns(x).ColumnName()

Than it is just using the table,
Cor

"Jeff" <no**@none.comschreef in bericht
news:45***********************@free.teranews.com.. .
>
The "DataColumns" part of your syntax didn't work, but the following minor
modification did.
ColName = tempA.ToTable.Columns(x).ColumnName()

Thanks. ...not sure why the original didn't work, but perhaps related to
something I would need to import first?

Jeff
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
>Jeff,

http://msdn.microsoft.com/library/de...tabletopic.asp

dim dcname as string = TempA.ToTable.DataColumns(x).Columnname

http://msdn.microsoft.com/library/de...nnametopic.asp

I hope this helps,

Cor

--
Posted via a free Usenet account from http://www.teranews.com

Sep 19 '06 #7

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

Similar topics

5
by: glakk | last post by:
I have a problem of migrating a database from one host to another. I can't do a dump on the source server. The only access I have is thru queries. So it looks like I'm going to have to query all...
2
by: Geert-Pieter Hof | last post by:
Hello, I use a ListView control (report view) to show the user a summary of error messages. The width of the column that holds the error messages is such that no horizontal scrollbar is needed....
0
by: Stephen Nesbitt | last post by:
All: Here's my implementation problem. I have a base class which has the responsibility for providing entry into the logging system. Part of the class responsibility is to ensure that lagger...
2
by: Garrett | last post by:
Need any help in determining which groups have been given security access to a folder. Searched DirectoryServices to no avail... Any Help?
6
by: Alex | last post by:
I have been loving the templated datacolumns of the datagrid. I have stumbled onto a problem though that is beyond by knowledge and I was hoping someone here could jumpstart me. My templated...
13
by: dennis | last post by:
Hello, I'm having trouble solving the following problem with DB2 UDB 8.2. I need to create a trigger that performs certain extra constraint validations (temporal uniqueness). One of the tables...
3
by: Jeff | last post by:
In .net2 using VB (Visual Web), I have the following code that properly determines the column name from the column number (5 in this example) from a single row table. ColName =...
2
by: patrimith | last post by:
Hi List, I am used to the following with Java: import some.package.MyClass; name = MyClass.class.getName(); The value for name will be "some.package.MyClass". For Python, I find:
3
by: Gord | last post by:
If I have a form open with a subform control on it in datasheet view that has its record source set to a query or a table, is it possible to determine which record the user has clicked into with...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.