PDA

Click to See Complete Forum and Search --> : Adoce problem


keko9
Jan 30th, 2008, 03:53 AM
' define constants for ADOCE

Public Const adOpenForwardOnly = 0
Public Const adOpenKeyset = 1
Public Const adOpenDynamic = 2
Public Const adOpenStatic = 3

Public Const adLockReadOnly = 1
Public Const adLockPessimistic = 2
Public Const adLockOptimistic = 3

Public Const adStateClosed = 0
Public Const adStateOpen = 1

' declare global variables
Public cnProdaja As ADOCE.Connection
Public rsProdaja As ADOCE.Recordset
This is code from vb6 mobile,how to use this in vb2005 mobile.

petevick
Jan 30th, 2008, 01:48 PM
hi,
what database are you trying to access - ADOCE as such doesn't exist in .Net CF.

Take a look at http://samples.gotdotnet.com/quickstart/CompactFramework/ which shows you how to use SqlServer Mobile.

Pete

Pete

keko9
Feb 5th, 2008, 09:04 AM
It only problem which stay is to declare those two variable:

Public cnProdaja As ADOCE.Connection
Public rsProdaja As ADOCE.Recordset

I tried with datareader but don't work.Is there some way to declare them on some other way.

petevick
Feb 5th, 2008, 09:10 AM
ADOCE is not supported in .NEt as I said originally. The samples I pointed you at shows you how to do it in SqlCE

What is the database you are currently using on the device???

keko9
Feb 6th, 2008, 02:39 AM
Public cnProdaja As New Data.SqlServerCe.SqlCeConnection
Public rsProdaja As New Data.SqlServerCe.SqlCeEngine

I tried on this way will see?
I can't use datareader!

keko9
Feb 6th, 2008, 02:55 AM
Code from vb6 pocket pc.
GridCtrl1.Row
rsProdaja.Fields
Combo1.ItemData
Combo1.ListIndex
GridCtrl1.ColWidth(0) = 500
GridCtrl1.CellFontBold = True

I have problem how to convert this code to to use in vb 2005 pocket pc !

petevick
Feb 6th, 2008, 04:27 AM
Hi,
to read records, do something like...

Dim cn As System.Data.SqlServerCe.SqlCeConnection
Dim cmd As System.Data.SqlServerCe.SqlCeCommand
Dim dtr As System.Data.SqlServerCe.SqlCeDataReader

Open your database...
cn.connection = "Data Source=\My Documents\mydb.sdf"
Try
cn.open
catch ex as exception
messagebox.show(ex.tostring)
end try


Read records....

cmd = New SqlCeCommand("SELECT * FROM Customers", cn)
dtr = cmd.ExecuteReader()

and to read records,

cmbCustomers.Items.Clear()
While dtr.Read()
cmbCustomers.Items.Add(dtr("CompanyName"))
End While

dtr.close
That should open a database, and read records into a combobox.

As to your other question, you can't just throw random statements, and expect them to be converted.

VB.Net is not the same as VB6, and as explained in other answers to your questions, it is more of a re-design and re-write using VB.Net.

Have you used VB.Net before?

Strider put together an excellent set of resources for beginning mobile development here (http://www.vbforums.com/showthread.php?t=409850&highlight=faq)

keko9
Feb 6th, 2008, 05:09 AM
Jes I do!

keko9
Feb 11th, 2008, 02:39 AM
I have code from vb6 and a must convert to vb2005.I vb6 Combo1.ItemData
Combo1.ListIndex
-------------------
ComboBox1.----
ComboBox1.----
In design i made combobox1 same but in vb6 i just name combo1.
What to use that vb2005 will accept !