Click here to Skip to main content
15,887,214 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionHow can I take information from a child form and show it to a parent form Pin
waner michaud19-Jun-09 11:45
waner michaud19-Jun-09 11:45 
AnswerRe: How can I take information from a child form and show it to a parent form Pin
Christian Graus19-Jun-09 12:43
protectorChristian Graus19-Jun-09 12:43 
GeneralRe: How can I take information from a child form and show it to a parent form Pin
waner michaud22-Jun-09 10:37
waner michaud22-Jun-09 10:37 
GeneralRe: How can I take information from a child form and show it to a parent form Pin
programmervb.netc++24-Jun-09 21:06
programmervb.netc++24-Jun-09 21:06 
GeneralRe: How can I take information from a child form and show it to a parent form Pin
waner michaud25-Jun-09 2:33
waner michaud25-Jun-09 2:33 
GeneralRe: How can I take information from a child form and show it to a parent form Pin
programmervb.netc++25-Jun-09 5:49
programmervb.netc++25-Jun-09 5:49 
GeneralRe: How can I take information from a child form and show it to a parent form Pin
waner michaud25-Jun-09 6:18
waner michaud25-Jun-09 6:18 
QuestionSMO Create and verify Indexes Pin
ghost80719-Jun-09 9:46
ghost80719-Jun-09 9:46 
I'm trying to write a utility that can compare a dataset to an existing SQL Server and then make changes to it via SMO
the problem i'm having currently is getting the indexes to be created properly.
dt is a table from the the .xsd dataset
TableToUpdate is the table i'm going to be making changes to.
VerifyTable is an exact copy of the table made at the same time TableToUpdate was created.

    Private Function UpdateColumn(ByRef TableToUpdate As Microsoft.SqlServer.Management.Smo.Table, ByVal ColumnToAdd As System.Data.DataColumn, ByVal dt As System.Data.DataTable, ByVal VerifyTable As Microsoft.SqlServer.Management.Smo.Table) As Boolean<br />
        Dim UpdateNeeded As Boolean = False<br />
        Dim idx As Index<br />
        Dim col As Column<br />
        col = TableToUpdate.Columns(ColumnToAdd.ColumnName)<br />
<br />
        col.Nullable = ColumnToAdd.AllowDBNull<br />
        col.DataType = GetTypeOfData(ColumnToAdd)<br />
<br />
        If Not ColumnToAdd.DefaultValue.Equals(DBNull.Value) Then<br />
            col.AddDefaultConstraint("DF_" & col.Name)<br />
            col.DefaultConstraint.Text = ColumnToAdd.DefaultValue.ToString<br />
        End If<br />
<br />
        col.Identity = ColumnToAdd.AutoIncrement<br />
        If col.Identity Then<br />
            col.IdentityIncrement = ColumnToAdd.AutoIncrementStep<br />
            col.IdentitySeed = ColumnToAdd.AutoIncrementSeed<br />
        End If<br />
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''<br />
''' Here is where i have problems<br />
''' Any Help in making this work would be greatly appreciated.<br />
''' I need this to Add key's(Primary and Index) if they are not there<br />
''' Delete it if it's not needed<br />
''' Or Change it if its needed<br />
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''<br />
        Dim pkColumns() As DataColumn<br />
        pkColumns = dt.PrimaryKey<br />
<br />
        If pkColumns.Contains(ColumnToAdd) Or ColumnToAdd.Unique Then<br />
            For Each i As Index In TableToUpdate.Indexes<br />
                If Not i.IndexedColumns.Contains(ColumnToAdd.ColumnName) Then<br />
                    idx = New Index<br />
                    idx.Parent = TableToUpdate<br />
                    If pkColumns.Contains(ColumnToAdd) Then<br />
                        idx.Name = "PK_" & ColumnToAdd.ColumnName & "_" & dt.TableName<br />
                        idx.IndexKeyType = IndexKeyType.DriPrimaryKey<br />
                    Else<br />
                        idx.Name = "IDX_" & ColumnToAdd.ColumnName & "_" & dt.TableName<br />
                        idx.IndexKeyType = IndexKeyType.DriUniqueKey<br />
                    End If<br />
                    idx.IndexedColumns.Add(New IndexedColumn(idx, ColumnToAdd.ColumnName))<br />
                    UpdateNeeded = True<br />
                End If<br />
            Next<br />
        Else<br />
            If TableToUpdate.Indexes(0).IndexedColumns.Contains(ColumnToAdd.ColumnName) Then<br />
                '        Item exists but should not<br />
                TableToUpdate.Indexes(0).IndexedColumns.Remove(ColumnToAdd.ColumnName)<br />
                UpdateNeeded = True<br />
            End If<br />
        End If<br />
<br />
        For Each p As Microsoft.SqlServer.Management.Smo.Property In col.Properties<br />
            If Not p.Value.Equals(VerifyTable.Columns(ColumnToAdd.ColumnName).Properties(p.Name).Value) Then Return True<br />
        Next<br />
        Return UpdateNeeded<br />
<br />
    End Function

Thank you
QuestionRe: SMO Create and verify Indexes Pin
ghost80722-Jun-09 2:56
ghost80722-Jun-09 2:56 
Questionin crystal report i want to assign datase to sub report Pin
Ashish Dudhatra19-Jun-09 7:13
Ashish Dudhatra19-Jun-09 7:13 
AnswerRe: in crystal report i want to assign datase to sub report [modified] Pin
ghost80719-Jun-09 10:12
ghost80719-Jun-09 10:12 
QuestionHow to know whether propertygrid..SelectedGridItem is having focus or not Pin
VB 8.019-Jun-09 4:50
VB 8.019-Jun-09 4:50 
QuestionTIFF with JPEG Compression Image Format in VB.Net Pin
wkitlam19-Jun-09 4:27
wkitlam19-Jun-09 4:27 
AnswerRe: TIFF with JPEG Compression Image Format in VB.Net Pin
Dave Kreskowiak19-Jun-09 4:30
mveDave Kreskowiak19-Jun-09 4:30 
GeneralRe: TIFF with JPEG Compression Image Format in VB.Net Pin
Jon_Boy19-Jun-09 6:17
Jon_Boy19-Jun-09 6:17 
QuestionHow to create composite key in a table using VB.NET? Pin
sivakumar.mariappan19-Jun-09 1:02
sivakumar.mariappan19-Jun-09 1:02 
AnswerRe: How to create composite key in a table using VB.NET? Pin
Dave Kreskowiak19-Jun-09 1:16
mveDave Kreskowiak19-Jun-09 1:16 
GeneralRe: How to create composite key in a table using VB.NET? Pin
sivakumar.mariappan19-Jun-09 1:37
sivakumar.mariappan19-Jun-09 1:37 
GeneralRe: How to create composite key in a table using VB.NET? Pin
Dave Kreskowiak19-Jun-09 4:28
mveDave Kreskowiak19-Jun-09 4:28 
AnswerRe: How to create composite key in a table using VB.NET? Pin
riced19-Jun-09 5:06
riced19-Jun-09 5:06 
GeneralRe: How to create composite key in a table using VB.NET? Pin
sivakumar.mariappan19-Jun-09 19:42
sivakumar.mariappan19-Jun-09 19:42 
QuestionPrinter Status Pin
specialdreamsin18-Jun-09 23:46
specialdreamsin18-Jun-09 23:46 
AnswerRe: Printer Status Pin
Christian Graus18-Jun-09 23:51
protectorChristian Graus18-Jun-09 23:51 
GeneralRe: Printer Status Pin
Dave Kreskowiak19-Jun-09 1:05
mveDave Kreskowiak19-Jun-09 1:05 
GeneralRe: Printer Status Pin
Nagy Vilmos19-Jun-09 1:08
professionalNagy Vilmos19-Jun-09 1:08 

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.