PDA to SQLServer

O

oscarml

Hi,

I'm developing an application for PocketPC 4.20.1081 (I think it means
Windows Mobile 2003). In this project, PDAs run a program made with VS2005
that connects with a SQL SERVER 2005 directly.

Is this a good idea? I mean, should I use SQL CE SERVER?

I've tried the program on windows and that works fine, but when testing in
PDA, it appears to work (load the employers from database in the first form)
but when I try to read some products, it fails.

Should I load any dll to the PDA, or VS2005 makes it directly?
 
P

Paul G. Tobey [eMVP]

You'll have to decide what makes sense. How reliable is the PDA's
connection to the network? If it might be out of range of your WiFi or
something, what will you do when you can't get data? It's *your*
application and operating environment that will determine what is the right
thing.

Paul T.
 
O

oscarml

Well, let's see if I understand (i'm quite new in this). COuld I use SQL Ce
SERVER installed in the PDA to have a copy from the hole SQL SERVER 2005 DB
that is in a PC? The problem is that the DB is quite big.

In case the PDA's connection is reliable, is there any problem in connecting
to a SQL SERVER in the same way a Windows application does? Do i need to copy
manually some dll to the PDA?
 
P

Paul G. Tobey [eMVP]

Well, let's see if I understand (i'm quite new in this). COuld I use SQL
Ce
SERVER installed in the PDA to have a copy from the hole SQL SERVER 2005
DB
that is in a PC? The problem is that the DB is quite big.

Yes, you could do that.
In case the PDA's connection is reliable, is there any problem in
connecting
to a SQL SERVER in the same way a Windows application does? Do i need to
copy
manually some dll to the PDA?

That's what you're doing now, as far as I can tell from your description.
You don't need to add anything to the device, as far as I know. The code in
the Compact Framework for accessing SQL Server is all that you should need.

Paul T.
 
O

oscarml

Thx a lot Paul. Good and quick answer!

Paul G. Tobey said:
Yes, you could do that.


That's what you're doing now, as far as I can tell from your description.
You don't need to add anything to the device, as far as I know. The code in
the Compact Framework for accessing SQL Server is all that you should need.

Paul T.
 
O

oscarml

Hi again,

I've discovered a problem in my application that seems very strange:

First of all say that in windows the application is working fine

When I do a sql query without parameters (I'm using 3 layers programming
calling store procedures) it works fine in the PDA, but when I use a Store
procedure which has parameters, it fails!

Here is the code for the store procedure which fails:

Public Shared ReadOnly Property constr() As SqlConnection
Get
Dim con As SqlConnection = New SqlConnection
con.ConnectionString = "Server=
192.168.1.36,2301;uid=palu;pwd=palu;database=CB_empresa"
Return con
End Get
End Property

Public Shared Function get_articuloByCB(ByVal par_CB As String) As Articulo
Dim articulo As New Articulo
Dim StoredProcedure As String = "get_articuloByCB"
Dim con As SqlConnection = constr()

Dim cmd As SqlCommand = New SqlCommand
cmd.Connection = con
cmd.CommandText = StoredProcedure
cmd.CommandType = CommandType.StoredProcedure
Dim param As SqlParameter = cmd.CreateParameter
param.SqlDbType = SqlDbType.VarChar
param.ParameterName = "CB"
param.Value = par_CB
cmd.Parameters.Add(param)
con.Open()
Dim dr As SqlDataReader = cmd.ExecuteReader
dr.Read()
articulo = New Articulo(dr.Item("id_articulo"), dr.Item("id_alb"),
dr.Item("id_prod"), dr.Item("id_prov"), dr.Item("unidades"),
dr.Item("fecha_in"), dr.Item("caducidad"), dr.Item("impresa"),
dr.Item("CB"))
dr.Close()
con.Close()
Return articulo
End Function


Do u see something wrong? thx
 
G

Ginny Caughey [MVP]

Try Parameters.AddWithValue instead of the approach you're using now and see
if that helps. I don't know if that will make a difference but I'm curious
if it does.
 
O

oscarml

Hi,

I've figured it out. It was this line: param.ParameterName = "CB"
it missed the "@CB"

Thx for ur attention.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top