View the data
create a new form add a data grid and leave the name to the default
paste this code
double click it and paste this code
you can use this code to make much more intresting applications for pocket pc
create a new form add a data grid and leave the name to the default
paste this code
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.LoadTo make the form close add a menu and name it close type this code
Dim cn As System.Data.SqlServerCe.SqlCeConnection
Dim cmd As System.Data.SqlServerCe.SqlCeCommand
Dim SQL As String
Dim dt As System.Data.DataTable
Dim da As System.Data.SqlServerCe.SqlCeDataAdapter
Try
' Open the database.
cn = New System.Data.SqlServerCe.SqlCeConnection(connstr)
cn.Open()
' Retrieve the customers
SQL = "SELECT * FROM customers"
cmd = New System.Data.SqlServerCe.SqlCeCommand(SQL, cn)
dt = New DataTable
da = New SqlCeDataAdapter
da.SelectCommand = cmd
da.SelectCommand.Connection = cn
da.Fill(dt)
DataGrid1.DataSource = dt
'MessageBox.Show(CStr(DataGrid1.VisibleRowCount))
DataGrid1.ColumnHeadersVisible = True
cn.Close()
Catch sqex As System.Data.SqlServerCe.SqlCeException
MessageBox.Show(sqex.ToString(), "DB operation failed")
End Try
End Sub
me.closeto enable the user to show this form go back to the main form add a new menu and name it show customers
double click it and paste this code
Dim f2 As New Form2This is it
f2.ShowDialog()
you can use this code to make much more intresting applications for pocket pc
No comments:
Post a Comment