Results 1 to 4 of 4

Thread: [RESOLVED] PPC database functionality

  1. #1

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Resolved [RESOLVED] PPC database functionality

    Ok - so I'm developing an app that will "download" from a SQL SERVER box two or three tables from a large database. Not all rows will go to the PPC - only those that the person is authorized to view (for instance). And not all columns - just those needed to support a mobile-display that I'm going to develop with VS2005 for the PPC.

    I've already installed MS SQL CE and have a proof-of-concept app written.

    Basic idea - person docks the PPC and runs the mobile-app. It finds no SDF file on the PPC so it creates it.

    It needs to be encrypted - which I know I can do when I create the SDF in VS2005 - hopefully that can be done with a "create-on-the-fly" SDF. I'm concerned about how to make sure they use a good password...

    At any rate - after the SDF is created the app will download somehow from the network SQL server. Not sure how it's going to authenticate - we use only window authentication - not sure how the PPC will be able to see the SQL box through the USB wire. Are there replication methods that can be used that I'm not aware of??

    Once the data is on the PPC the user is able to view it remotely. If the user tries to access the SDF on a future date and cannot load the password successfully we plan on "deleting" the SDF - forcing them to return to the docking station to re-load.

    Any opinions or help that can be offered in regard to these ideas - feel free!

    Thanks in advance.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  2. #2
    Frenzied Member
    Join Date
    Oct 2005
    Posts
    1,286

    Re: PPC database functionality

    Hi,
    you can use SqlCeClient or Merge/Replication or RDA - I have written articles on the first 2 on http://www.devbuzz.com

    For authentication, you will need to send use/pwd for replication - hold them in some sort of config file, encrypted if need be.

    What you are suggesting is a perfectly good solution

    HTH

    Pete
    Pete Vickers
    MVP - Device Application Development
    http://www.gui-innovations.com http://mobileworld.appamundi.com/blogs/

  3. #3

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: PPC database functionality

    I'm going to have to do more research in the sync part of the PPC to the network server. We only use WINDOWS AUTHENICATION on the network - for security reasons - and the only way to find out the "building role" of the user is to look up there Windows Username in a table of roles in the network DB...

    If anyone is interested - or wants to offer some constructive criticism - here's the code so far.

    Very, very easy - once you get around the difference in the CE world.

    VB Code:
    1. Imports System.Data.SqlServerCe
    2.  
    3. Public Class APC
    4.  
    5.     Private Dcn As SqlCeConnection
    6.     Private Drc As SqlCeCommand
    7.     Private Dse As SqlCeEngine
    8.  
    9.     Private Sub APC_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    10.         TextBox.PasswordChar = "*"
    11.         TextBox.Focus()
    12.     End Sub
    13.  
    14.     Private Sub Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button.Click
    15.         Cursor.Current = Cursors.WaitCursor
    16.         If TextBox.PasswordChar = "*" Then
    17.             Dim dcn As New SqlCeConnection
    18.             Dim booNotFound As Boolean
    19.             dcn.ConnectionString = "DataSource=\My Documents\Business\APC.sdf; Password=" & TextBox.Text
    20.             Try
    21.                 dcn.Open()
    22.                 TextBox.PasswordChar = ""
    23.             Catch ex As SqlCeException
    24.                 If ex.NativeError = 25046 Then
    25.                     booNotFound = True
    26.                 Else
    27.                     MsgBox(ex.Message)
    28.                 End If
    29.             Catch ex As Exception
    30.                 MsgBox(ex.Message)
    31.             End Try
    32.             If booNotFound Then
    33.                 Dim dse As New SqlCeEngine("DataSource=\My Documents\Business\APC.sdf; Password=" & TextBox.Text)
    34.                 Try
    35.                     dse.CreateDatabase()
    36.                     If LoadDatabase() = False Then
    37.                         System.IO.File.Delete("\My Documents\Business\APC.sdf")
    38.                         Cursor.Current = Cursors.Default
    39.                         MsgBox("Database did not sync!")
    40.                         Me.Close()
    41.                         Exit Sub
    42.                     End If
    43.                     TextBox.PasswordChar = ""
    44.                 Catch ex As Exception
    45.                     MsgBox(ex.Message)
    46.                 End Try
    47.             End If
    48.             If TextBox.PasswordChar = "*" Then
    49.                 TextBox.SelectAll()
    50.                 TextBox.Focus()
    51.             Else
    52.                 TextBox.Text = ""
    53.                 Label.Text = "Last Name"
    54.             End If
    55.         End If
    56.         Cursor.Current = Cursors.Default
    57.     End Sub
    58.  
    59.     Private Function LoadDatabase() As Boolean
    60.         LoadDatabase = False
    61.         ' code goes here to sync database with network SQL server
    62.     End Function
    63.  
    64.     Private Sub TextBox_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox.GotFocus
    65.         InputPanel.Enabled = True
    66.     End Sub
    67.  
    68.     Private Sub TextBox_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox.LostFocus
    69.         InputPanel.Enabled = False
    70.     End Sub
    71. End Class

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  4. #4

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: PPC database functionality

    Changed the connection string to this - for encryption...

    Code:
    Dim dse As New SqlCeEngine("DataSource=\My Documents\Business\APC.sdf; Password=" _
                                    & TextBox.Text & ";encrypt database=TRUE")
    From this MSDN article: http://msdn2.microsoft.com/en-us/lib...1(SQL.80).aspx

    I did not have to install any dll's - this apparently worked so it must have been setup by my initial installs of SQL CE.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width