473,394 Members | 1,739 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,394 software developers and data experts.

Binding Datagrid to SQLCE DB

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
Nov 21 '05 #1
1 6283
Nevermind, found it. I changed the ds (dataset) to dt (datatable) and all is
well now.
Thanks
"Scott Toney" <Sc***@Spine-Brain.com> wrote in message
news:11*************@corp.supernews.com...
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

Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Arcot | last post by:
hi My sample XML file is <root> <header> <elem>ee</elem> </header> <trailerlist> <trailerrow> <elem>1</elem>
5
by: Dalibor Kusic | last post by:
The DataTable contains, for example, only one column of lets say Person class. Person class has three fields, and a constructor that takes a single string and parses it over those three fields. ...
0
by: Emaga75 | last post by:
How to set dynamic binding datagrid column title£¿
5
by: PawelR | last post by:
Hello group, I my apps I have two dataGrids - dgParent, dgChild to show rows from two tables. Tables are relations one to more in dataBase. I use sqlDataAdater (sdaParent, sdaChild) to fill myDS....
3
by: Rami | last post by:
Hey, I Tried to bind a DataGrid to an ArrayList, and had 2 problems: 1. The DataGrid shows the Length property of the items instead of their text - how can I change that? 2. After binding, I add...
2
by: Stephen Miller | last post by:
I am using the OnItemDataBound event of Repeater control to nest a DataGrid within the Repeater. When I attempt to bind to the DataGrid using the DataSource method I get the error message "Object...
0
by: Leigh Webber | last post by:
I have an ActiveX dll written in VB6. It exposes a class called CustomerDisplays, with a Public Function NewEnum (procedure ID -4, hide this member), and a Public Function Item (default) and a...
5
by: Rami | last post by:
Hey, I Tried to bind a DataGrid to an ArrayList, and had 2 problems: 1. The DataGrid shows the Length property of the items instead of their text - how can I change that? 2. After binding, I add...
0
by: nimitsharma16 | last post by:
Hi, I need to bind the Datagrid control with a 2D Array. I guess so it will be done by converting it in an arraylist first then later on binding it with Datagrid control. Can anyone suggect me...
4
by: Alan Gillott | last post by:
Is it possible to bind a Datagrid to a 2 dimentional Array? Or even a Collection? I know Linq can in vb2008 but I don't want to download 2008 just yet. Lots of examples binding text boxes to Id...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.