| re: Binding Datagrid to SQLCE DB
Nevermind, found it. I changed the ds (dataset) to dt (datatable) and all is
well now.
Thanks
"Scott Toney" <Scott@Spine-Brain.com> wrote in message
news:117212ttomhd21a@corp.supernews.com...[color=blue]
>I have the following code that "seems" to work but a portion of "Header
>column 1" and Row Header 1 with a black arrow pointing right. If anyone has
>any information it will be greatly appreciated.
>
> Scott
> Private Sub LoadApptList()
> Dim cn As System.Data.SqlServerCe.SqlCeConnection
> Dim cmd As System.Data.SqlServerCe.SqlCeCommand
> 'Dim dtr As System.Data.SqlServerCe.SqlCeDataReader
> Dim SQL As String
> Dim ds As System.Data.DataSet
> Dim da As System.Data.SqlServerCe.SqlCeDataAdapter
>
> Try
> ' Open the database.
> cn = New System.Data.SqlServerCe.SqlCeConnection("Data
> Source=\My Documents\Appt.sdf")
> cn.Open()
>
> ' Retrieve the appointments
> SQL = "SELECT Appt.ApptID, Appt.CustID, "
> SQL = SQL & "Cust.CustName, Appt.Time "
> SQL = SQL & "FROM Appt INNER JOIN Cust ON "
> SQL = SQL & "Appt.CustID = Cust.CustID WHERE "
> SQL = SQL & "Appt.Show <> 'N'"
> cmd = New System.Data.SqlServerCe.SqlCeCommand(SQL, cn)
> 'dtr = cmd.ExecuteReader()
>
> ds = New DataSet
> da = New SqlServerCe.SqlCeDataAdapter
> da.SelectCommand = cmd
> da.SelectCommand.Connection = cn
> da.Fill(ds)
> ApptGrid.DataSource = ds
> MessageBox.Show(CStr(ApptGrid.VisibleRowCount))
> ApptGrid.ColumnHeadersVisible = True
> 'ApptGrid.BringToFront()
> 'ApptGrid.DataSource = dtr
>
>
> Catch sqex As System.Data.SqlServerCe.SqlCeException
> MessageBox.Show(sqex.ToString(), "DB operation failed")
> Catch er As Exception
> MessageBox.Show(er.ToString)
> End Try
>
> ' Clean-up.
> 'dtr.Close()
> cn.Close()
>
> End Sub
>
>[/color] |