R
Rich
Code in the sample below (and numerous variations) runs
OK...The query works and successfully binds data to the
grid. But the Column Headers and Widths still look as if
the cde that built the column styles colletion, etc. did
not even run. When I run similar code on a different
platform using SQL Server (and of course the SQL Data
Adapter), everything works fine. In fact, it's a great
way to manipulate amny aspects of grid
formatting....colors, fonts, gridlines, the whole nine
yards.
MSDN documents this quite well but I found nothing that
says it should not work with the OLE DB Adapter, etc.
(I'm using it with Oracle)
Anybody know what's up with this?
Private Sub FillDocGrid(ByVal DocID As Integer)
OleDbSelectCommand2.CommandText=SelectDocsCmd &
DocID.ToString & "'"
DocumentsDA.Fill(TechLibDS, "Documents")
'Tried setting Data Source and Data Member
'both ways...runs the same either way
DocGrid.DataSource = TechLibDS.Tables("Documents")
'DocGrid.DataSource = TechLibDS
'DocGrid.DataMember = "Documents"
Dim DocGridTS As New DataGridTableStyle()
DocGridTS.RowHeadersVisible = False
'Tried setting Mapping Name both ways...
'runs the same either way
DocGridTS.MappingName = "TechLibDDS.Documents"
'DocGridTS.MappingName = "Documents"
Dim IDCS As New DataGridTextBoxColumn()
IDCS.MappingName = "ID"
IDCS.HeaderText = ""
IDCS.Width = 0
DocGridTS.GridColumnStyles.Add(IDCS)
Dim DocDateCS As New DataGridTextBoxColumn()
DocDateCS.MappingName = "DocDate"
DocDateCS.HeaderText = "Date"
DocDateCS.Width = 120
DocGridTS.GridColumnStyles.Add(DocDateCS)
Dim TitleCS As New DataGridTextBoxColumn()
TitleCS.MappingName = "Title"
TitleCS.HeaderText = "Document Title"
TitleCS.Width = 400
DocGridTS.GridColumnStyles.Add(TitleCS)
Dim DescCS As New DataGridTextBoxColumn()
DescCS.MappingName = "Description"
DescCS.HeaderText = "Document Descripition"
DescCS.Width = 800
DocGridTS.GridColumnStyles.Add(DescCS)
DocGrid.TableStyles.Clear()
DocGrid.TableStyles.Add(DocGridTS)
End Sub
OK...The query works and successfully binds data to the
grid. But the Column Headers and Widths still look as if
the cde that built the column styles colletion, etc. did
not even run. When I run similar code on a different
platform using SQL Server (and of course the SQL Data
Adapter), everything works fine. In fact, it's a great
way to manipulate amny aspects of grid
formatting....colors, fonts, gridlines, the whole nine
yards.
MSDN documents this quite well but I found nothing that
says it should not work with the OLE DB Adapter, etc.
(I'm using it with Oracle)
Anybody know what's up with this?
Private Sub FillDocGrid(ByVal DocID As Integer)
OleDbSelectCommand2.CommandText=SelectDocsCmd &
DocID.ToString & "'"
DocumentsDA.Fill(TechLibDS, "Documents")
'Tried setting Data Source and Data Member
'both ways...runs the same either way
DocGrid.DataSource = TechLibDS.Tables("Documents")
'DocGrid.DataSource = TechLibDS
'DocGrid.DataMember = "Documents"
Dim DocGridTS As New DataGridTableStyle()
DocGridTS.RowHeadersVisible = False
'Tried setting Mapping Name both ways...
'runs the same either way
DocGridTS.MappingName = "TechLibDDS.Documents"
'DocGridTS.MappingName = "Documents"
Dim IDCS As New DataGridTextBoxColumn()
IDCS.MappingName = "ID"
IDCS.HeaderText = ""
IDCS.Width = 0
DocGridTS.GridColumnStyles.Add(IDCS)
Dim DocDateCS As New DataGridTextBoxColumn()
DocDateCS.MappingName = "DocDate"
DocDateCS.HeaderText = "Date"
DocDateCS.Width = 120
DocGridTS.GridColumnStyles.Add(DocDateCS)
Dim TitleCS As New DataGridTextBoxColumn()
TitleCS.MappingName = "Title"
TitleCS.HeaderText = "Document Title"
TitleCS.Width = 400
DocGridTS.GridColumnStyles.Add(TitleCS)
Dim DescCS As New DataGridTextBoxColumn()
DescCS.MappingName = "Description"
DescCS.HeaderText = "Document Descripition"
DescCS.Width = 800
DocGridTS.GridColumnStyles.Add(DescCS)
DocGrid.TableStyles.Clear()
DocGrid.TableStyles.Add(DocGridTS)
End Sub