Click here to Skip to main content
15,920,687 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Cannot inherits Image class?????? Pin
Dave Kreskowiak5-May-06 6:31
mveDave Kreskowiak5-May-06 6:31 
Question<b>Tranlation of New Event<b> Pin
eatwork4-May-06 12:16
eatwork4-May-06 12:16 
AnswerRe: Tranlation of New Event Pin
Dave Doknjas5-May-06 14:05
Dave Doknjas5-May-06 14:05 
GeneralRe: Tranlation of New Event Pin
eatwork8-May-06 5:37
eatwork8-May-06 5:37 
GeneralRe: Tranlation of New Event Pin
Dave Doknjas8-May-06 6:03
Dave Doknjas8-May-06 6:03 
QuestionNeed help getting info out of my sortedlist Pin
crash8934-May-06 10:32
crash8934-May-06 10:32 
AnswerRe: Need help getting info out of my sortedlist Pin
crash8934-May-06 10:36
crash8934-May-06 10:36 
QuestionRetriving Field schema using ADO Pin
Quecumber2564-May-06 9:44
Quecumber2564-May-06 9:44 
Hi All,
I'm using VB6 to retrieve the database table's schema. I have another routine that returns the some of the table Fields schema information, but it dosn't label the primary key field.

Here are the routines I'm using:
Private Sub List_DB_Tables(cnnDB As ADODB.Connection)
On Error GoTo List_DB_Tables_Err
Dim itmX As ListItem
Dim lngLen As Long
lvTables.ListItems.Clear
lvFields.ListItems.Clear
Set rstSchema = cnnDB.OpenSchema(adSchemaTables)

With rstSchema
Do Until .EOF
If (UCase(!TABLE_TYPE) = "ACCESS TABLE") Or (UCase(!TABLE_TYPE) = "SYSTEM TABLE") Then
.MoveNext
Else
Set itmX = lvTables.ListItems.Add(, , !TABLE_NAME)
Call AutoSizeColumn(lvTables, 0)
itmX.SubItems(1) = !TABLE_TYPE
Call AutoSizeColumn(lvTables, 1)
.MoveNext
End If
Loop
End With

List_DB_Tables_Exit:
On Error Resume Next
rstSchema.Close
Set rstSchema = Nothing
Exit Sub

List_DB_Tables_Err:
Msg = "Error in frmMainMenu - List_DB_Tables subroutine. " & vbCr & _
"Error # " & Str(Err.Number) & " was generated by " _
& Err.Source & vbCr & Err.Description
MsgBox Msg, , "Error", Err.HelpFile, Err.HelpContext
Resume List_DB_Tables_Exit
End Sub

Private Sub List_Fields_In_Table(cnnDB As ADODB.Connection, strTable As String)
On Error GoTo List_Fields_In_Table_Err
Dim itmX As ListItem
Dim J As Integer
Dim fld As ADODB.Field
Dim prp As ADODB.Property
lvFields.ListItems.Clear
Set rstSchema = New ADODB.Recordset
strSQL = "SELECT " & strTable & ".* FROM " & strTable & ";"
rstSchema.Open strTable, cnnDB, , , adCmdTable
' Enumerate the Fields collection of the strtable
For Each fld In rstSchema.Fields
Set itmX = lvFields.ListItems.Add(, , fld.Name)
Call AutoSizeColumn(lvFields, 0)
itmX.SubItems(1) = FieldType(fld.Type)
Call AutoSizeColumn(lvFields, 1)
Next fld
'reset the dynamic array size
arryElements = lvFields.ListItems.Count
ReDim arryFields(arryElements)
'Load array with field names
For J = 1 To arryElements
arryFields(J) = lvFields.ListItems(J).Text
Next J

List_Fields_In_Table_Exit:
On Error Resume Next
rstSchema.Close
Set rstSchema = Nothing
Exit Sub

List_Fields_In_Table_Err:
Msg = "Error in frmMainMenu - List_Fields_In_Table subroutine. " & vbCr & _
"Error # " & Str(Err.Number) & " was generated by " _
& Err.Source & vbCr & Err.Description
MsgBox Msg, , "Error", Err.HelpFile, Err.HelpContext
Resume List_Fields_In_Table_Exit
End Sub
QuestionFile replace and backup Pin
erniebert4-May-06 7:16
erniebert4-May-06 7:16 
QuestionReport Problem...Please help Pin
airprince4-May-06 6:54
airprince4-May-06 6:54 
AnswerRe: Report Problem...Please help Pin
Mekong River4-May-06 15:51
Mekong River4-May-06 15:51 
QuestionPlease Help Me.... Pin
airprince4-May-06 6:42
airprince4-May-06 6:42 
AnswerRe: Please Help Me.... Pin
Guffa4-May-06 8:09
Guffa4-May-06 8:09 
QuestionDatagrid: how to detect uncommitted changes? Pin
Roger Harvest4-May-06 6:39
Roger Harvest4-May-06 6:39 
QuestionPInvoke stack balance detected? Pin
Rashar4-May-06 6:25
Rashar4-May-06 6:25 
AnswerRe: PInvoke stack balance detected? Pin
kasik4-May-06 7:23
kasik4-May-06 7:23 
QuestionVB.Net Arrays Pin
passionirie4-May-06 5:22
passionirie4-May-06 5:22 
AnswerRe: VB.Net Arrays Pin
J4amieC4-May-06 5:40
J4amieC4-May-06 5:40 
QuestionCOMBOBOX Pin
moveman4-May-06 5:20
moveman4-May-06 5:20 
AnswerRe: COMBOBOX Pin
Quecumber2564-May-06 6:01
Quecumber2564-May-06 6:01 
AnswerRe: COMBOBOX Pin
Quecumber2564-May-06 6:28
Quecumber2564-May-06 6:28 
QuestionFREE .NET Related Material Pin
dotnetguide4-May-06 5:03
dotnetguide4-May-06 5:03 
AnswerRe: FREE .NET Related Material Pin
J4amieC4-May-06 5:39
J4amieC4-May-06 5:39 
Questiontextbox Pin
bawades4-May-06 4:17
bawades4-May-06 4:17 
AnswerRe: textbox Pin
Damoche104-May-06 5:13
Damoche104-May-06 5:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.