Connecting Tech Pros Worldwide Forums | Help | Site Map

Need to do this in .NET

Randy
Guest
 
Posts: n/a
#1: Jul 21 '05
In ASP I used the following Code to get the table name
from a XL db. I have been looking how to do this in .NET
and can't seem to find it. Can any of you guys help me
out.

strTable = getXLName(XLConn)

Function getXLName(obj)
SET RsN = obj.OpenSchema(20)
getXLName = RsN("TABLE_NAME")
RsN.Close
End Function


Dino Chiesa [Microsoft]
Guest
 
Posts: n/a
#2: Jul 21 '05

re: Need to do this in .NET


Dim SheetList As System.Data.DataTable =
conn.GetOleDbSchemaTable(System.Data.OleDb.OleDbSc hemaGuid.Tables, New
object() { Nothing, Nothing, Nothing, "TABLE"})
' here, we get the name of the first (0th) sheet
SheetName= "[" & SheetList.Rows(0)("TABLE_NAME").ToString()
& "]"



"Randy" <anonymous@discussions.microsoft.com> wrote in message
news:065d01c3bead$be69a4c0$a101280a@phx.gbl...[color=blue]
> In ASP I used the following Code to get the table name
> from a XL db. I have been looking how to do this in .NET
> and can't seem to find it. Can any of you guys help me
> out.
>
> strTable = getXLName(XLConn)
>
> Function getXLName(obj)
> SET RsN = obj.OpenSchema(20)
> getXLName = RsN("TABLE_NAME")
> RsN.Close
> End Function
>[/color]


Randy
Guest
 
Posts: n/a
#3: Jul 21 '05

re: Need to do this in .NET


Thanks. I was moving in that direction. I couldn't figure
out how to get only the first name.

Thanks again![color=blue]
>-----Original Message-----
> Dim SheetList As System.Data.DataTable =
>conn.GetOleDbSchemaTable[/color]
(System.Data.OleDb.OleDbSchemaGuid.Tables, New[color=blue]
>object() { Nothing, Nothing, Nothing, "TABLE"})
> ' here, we get the name of the first[/color]
(0th) sheet[color=blue]
> SheetName= "[" & SheetList.Rows(0)[/color]
("TABLE_NAME").ToString()[color=blue]
>& "]"
>
>
>
>"Randy" <anonymous@discussions.microsoft.com> wrote in[/color]
message[color=blue]
>news:065d01c3bead$be69a4c0$a101280a@phx.gbl...[color=green]
>> In ASP I used the following Code to get the table name
>> from a XL db. I have been looking how to do this in .NET
>> and can't seem to find it. Can any of you guys help me
>> out.
>>
>> strTable = getXLName(XLConn)
>>
>> Function getXLName(obj)
>> SET RsN = obj.OpenSchema(20)
>> getXLName = RsN("TABLE_NAME")
>> RsN.Close
>> End Function
>>[/color]
>
>
>.
>[/color]
Closed Thread


Similar .NET Framework bytes