Hi Everybody,
I am new to Windows Mobile programming. I am making an Inventory gathering system for a retail store.
The procedure is to scan the barcode and shows the details of the item (ex. Item Name, Retail price,Unit Cost etc.) then a there a textbox to encode the quantity being count. My first question is, how can i load table from my main database (SQL 2000 Server) for example DATA_MASTER table into my SQL CE 3.5 database. Second, How then I INSERT the gathered data (ex. ENCODED_DATA table from SQL CE 3.5 into the main server SQL 2000.
According to this link (http://blogs.msdn.com/sqlservercompact/archive/2007/12/19/connectivity-cross-version-compatibility-sql-server-compact-3-5.aspx). sql server 2000 is not supported by sqlce 3.5. However, some sources said it is posible using Microsoft Synchronization Services for ADO.NET and that is what i really wanted to know. I am using Visual Studio 2008 VB language, Active sync 4.5, Win XP SP2, Win Mobile Symbol PPT8800 Pocket PC, SQL server 2000 under Windows 2003 server R2 , SQL CE 3.5.
I have already a piece of code started and works fine in my Pocket PC. Any help is much appreciated Thank you so much
Imports System.Data.SqlServerCe
Imports System.Data
Public Class InvEntry
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Cursor.Current = Cursors.WaitCursor
Dim cmd As SqlCeCommand = Conn_PPsql.CreateCommand()
cmd.CommandType = CommandType.TableDirect
cmd.IndexName = "PK_ItemMaster"
cmd.CommandText = "ItemMaster"
cmd.SetRange(DbRangeOptions.Match, New Object() {Trim(BarCode.Text)}, Nothing)
Dim reader As SqlCeDataReader = cmd.ExecuteReader(CommandBehavior.Default)
'MessageBox.Show(String.Format("{0} ; {1}", reader("Order ID"), reader("Order Date")))
If reader.Read() Then
lblItemDesc.Text = reader("ItemDesc")
lblPrice.Text = Format(reader("Price"), "#,##0.00")
txtqty.Focus()
Else
MsgBox("Item not found", MsgBoxStyle.Information, "Advisory...")
lblItemDesc.Text = vbNullString
lblPrice.Text = vbNullString
BarCode.Focus()
End If
Cursor.Current = Cursors.Default
End Sub
Private Sub InvEntry_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ModCon.OpenPPsql()
' This Call a Module to open the database
Public Sub OpenPPsql()
Try
Dim APConStr As String = "Data Source=\Program Files\PocketINV\SqlPP.sdf; " _
& " Persist Security Info=False;"
Conn_PPsql.ConnectionString = APConStr
Conn_PPsql.Open()
Catch ex As Exception
Cursor.Current = Cursors.Default
MsgBox(ex.Message)
End Try
End Sub