|
-
Jan 30th, 2008, 04:53 AM
#1
Thread Starter
Addicted Member
Adoce problem
' 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.
-
Jan 30th, 2008, 02:48 PM
#2
Frenzied Member
Re: Adoce problem
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/quickst...pactFramework/ which shows you how to use SqlServer Mobile.
Pete
Pete
-
Feb 5th, 2008, 10:04 AM
#3
Thread Starter
Addicted Member
Re: Adoce problem
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.
-
Feb 5th, 2008, 10:10 AM
#4
Frenzied Member
Re: Adoce problem
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???
-
Feb 6th, 2008, 03:39 AM
#5
Thread Starter
Addicted Member
Re: Adoce problem
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!
-
Feb 6th, 2008, 03:55 AM
#6
Thread Starter
Addicted Member
Re: Adoce problem
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 !
-
Feb 6th, 2008, 05:27 AM
#7
Frenzied Member
Re: Adoce problem
Hi,
to read records, do something like...
Code:
Dim cn As System.Data.SqlServerCe.SqlCeConnection
Dim cmd As System.Data.SqlServerCe.SqlCeCommand
Dim dtr As System.Data.SqlServerCe.SqlCeDataReader
Open your database...
Code:
cn.connection = "Data Source=\My Documents\mydb.sdf"
Try
cn.open
catch ex as exception
messagebox.show(ex.tostring)
end try
Read records....
Code:
cmd = New SqlCeCommand("SELECT * FROM Customers", cn)
dtr = cmd.ExecuteReader()
and to read records,
Code:
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
Last edited by petevick; Feb 6th, 2008 at 05:42 AM.
-
Feb 6th, 2008, 06:09 AM
#8
Thread Starter
Addicted Member
-
Feb 11th, 2008, 03:39 AM
#9
Thread Starter
Addicted Member
Re: Adoce problem
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 !
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|