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

how this statements converts into c#.pls tell me,these state ments r in vb6.

Public Function ListFields(sConnect As String, stable As String, sFields As String, iErrCode As Integer, sErrMsg As String)

Dim catDB As ADOX.Catalog
Dim sCol As ADOX.Column
Dim sKey As ADOX.Key
Dim sInd As ADOX.Index
Dim objContext As COMSVCSLib.ObjectContext
Dim jcnt As Integer
Dim Info2 As Variant
Dim iRow1 As Integer
'Dim InfoDoc2 As Variant
On Error GoTo ErrHandler

iErrCode = 0
Set objContext = GetObjectContext()
Set catDB = New ADOX.Catalog
Set tblList = New ADOX.Table
Set sCol = New ADOX.Column
Set sKey = New ADOX.Key
Set sInd = New ADOX.Index

iErrCode = 0
Set catDB = New ADOX.Catalog
catDB.ActiveConnection = sConnect

iRow1 = iRow1 + 1

Set Info2 = infodoc2.createNode(1, "Table_Columns" & iRow1, "")
infodoc2.documentElement.appendChild (Info2)

For Each
If tblList.Type = "TABLE" Then
If LCase(Trim(tblList.Name)) = LCase(Trim(stable)) Then
For Each sCol In tblList.Columns
jcnt = jcnt + 1
Set Info2 = infodoc2.createNode(1, "Row" & jcnt, "")
'InfoDoc2.documentElement.childNodes(iRow1 - 1).appendChild (Info2)
infodoc2.documentElement.childNodes(infodoc2.docum entElement.childNodes.length - 1).appendChild (Info2)
Info2.setAttribute "TABLE_NAME", tblList.Name
Info2.setAttribute "COLUMN_NAME", sCol.Name
Info2.setAttribute "TYPE_NAME", sCol.Type
Select Case sCol.Type
Case 2
Info2.setAttribute "TYPE_NAME", "smallint"
Info2.setAttribute "LENGTH", 2
Case 3
Info2.setAttribute "TYPE_NAME", "int"
Info2.setAttribute "LENGTH", 4
Case 4
Info2.setAttribute "TYPE_NAME", "real"
Info2.setAttribute "LENGTH", 4
Case 5
Info2.setAttribute "TYPE_NAME", "float"
Info2.setAttribute "LENGTH", 8
Case 6
Info2.setAttribute "TYPE_NAME", "money"
Info2.setAttribute "LENGTH", 8
Case 11
Info2.setAttribute "TYPE_NAME", "bit"
Info2.setAttribute "LENGTH", 1
Case 17
Info2.setAttribute "TYPE_NAME", "tinyint"
Info2.setAttribute "LENGTH", 1
Case 20
Info2.setAttribute "TYPE_NAME", "bigint"
Info2.setAttribute "LENGTH", 20
Case 72
Info2.setAttribute "TYPE_NAME", "uniqueidentifier"
Info2.setAttribute "LENGTH", 16
Case 128
Info2.setAttribute "TYPE_NAME", "binary"
Info2.setAttribute "LENGTH", sCol.DefinedSize
Case 129
Info2.setAttribute "TYPE_NAME", "char"
Info2.setAttribute "LENGTH", sCol.DefinedSize
Case 130
Info2.setAttribute "TYPE_NAME", "nchar"
Info2.setAttribute "LENGTH", sCol.DefinedSize
Case 131
Info2.setAttribute "TYPE_NAME", "decimal"
Info2.setAttribute "LENGTH", 9
Case 135
Info2.setAttribute "TYPE_NAME", "datetime"
Info2.setAttribute "LENGTH", 8
Case 200
Info2.setAttribute "TYPE_NAME", "varchar"
Info2.setAttribute "LENGTH", sCol.DefinedSize
Case 201
Info2.setAttribute "TYPE_NAME", "text"
Info2.setAttribute "LENGTH", 16
Case 202
Info2.setAttribute "TYPE_NAME", "nvarchar"
Info2.setAttribute "LENGTH", sCol.DefinedSize
Case 203
Info2.setAttribute "TYPE_NAME", "ntext"
Info2.setAttribute "LENGTH", 16
Case 204
Info2.setAttribute "TYPE_NAME", "varbinary"
Info2.setAttribute "LENGTH", sCol.DefinedSize
Case 205
Info2.setAttribute "TYPE_NAME", "image"
Info2.setAttribute "LENGTH", 16
End Select
Next
For Each sInd In tblList.Indexes
For Each sCol In sInd.Columns
If sInd.PrimaryKey = True Then
jcnt = jcnt + 1
Set Info2 = infodoc2.createNode(1, "Row" & jcnt, "")
'InfoDoc2.documentElement.childNodes(iRow1 - 1).appendChild (Info2)
infodoc2.documentElement.childNodes(infodoc2.docum entElement.childNodes.length - 1).appendChild (Info2)
Info2.setAttribute "TABLE_NAME", tblList.Name
Info2.setAttribute "COLUMN_NAME", sCol.Name
End If
Next
Next
Exit For
End If
End If
Next

sFields = infodoc2.xml

If iErrCode = 0 Then
ListFields = True
If Not (objContext Is Nothing) Then
objContext.SetComplete
End If
Else
ListFields = False
If Not (objContext Is Nothing) Then
objContext.SetAbort
End If
End If
Set catDB = Nothing
Set tblList = Nothing
Set sCol = Nothing
Set sKey = Nothing
Set sInd = Nothing
Set objContext = Nothing

Exit Function
ErrHandler:

iErrCode = 1
sErrMsg = Err.Description
ListFields = False
If Not (objContext Is Nothing) Then
objContext.SetAbort
End If
Set catDB = Nothing
Set tblList = Nothing
Set sCol = Nothing
Set sKey = Nothing
Set sInd = Nothing
Set objContext = Nothing
End Function
Dec 23 '10 #1
0 882

Sign in to post your reply or Sign up for a free account.

Similar topics

303
by: mike420 | last post by:
In the context of LATEX, some Pythonista asked what the big successes of Lisp were. I think there were at least three *big* successes. a. orbitz.com web site uses Lisp for algorithms, etc. b....
16
by: ram0812 | last post by:
Helo guys, I am trying to query the MSSQL DB using ADO. I am not able to make the LIKE statement fetch the correct results. Can anyone tell me what I need to do to get this working? Below is the...
2
by: Ivers | last post by:
My C# asp.net app (.NET 1.1) can generate an email whose body contains a link to the current page of the app. When the recipient of the email clicks the link (usually from Outlook), the app...
10
by: technocrat | last post by:
How can i find the load state of the table using SQL, i can do "load query table tablename" but i cannot execute this as a sql statement. What i want to do is, i m using a java stored priocedure to...
0
by: jdn4929 | last post by:
The state server has closed an expired TCP/IP connection. The IP address of the client is 127.0.0.1. The expired Read operation began at 11/16/2007 14:31:49. This one has been bothering me for...
67
by: Rui Maciel | last post by:
I've been delving into finite state machines and at this time it seems that the best way to implement them is through an intense use of the goto statement. Yet, everyone plus their granmother is...
17
by: Navodit | last post by:
So I have some code like: if (document.Insurance.State.selectedIndex == 1) { ifIll(); } else if (document.Insurance.State.selectedIndex == 2) { elseKan(); }
0
by: chandusmiles | last post by:
hi friends can u tell me new topics are added in .net 3.5 with examples i learned .net2.0 pls help these topics best regards chandu
1
by: zaimin | last post by:
Hi I have a table tracking when members attend meetings. Field 1 (Attended Meeting) = Yes/No type data type Field 2 (Did the Member do a Presentation?) = Yes/No data type Field 3 (Topic of...
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
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
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.