PC Review Forums Newsgroups Microsoft DotNet Microsoft Dot NET Compact Framework connect to my cdb file...

Reply

connect to my cdb file...

 
Thread Tools Rate Thread
Old 05-12-2006, 04:56 PM   #1
amiga500@gmail.com
Guest
 
Posts: n/a
Default connect to my cdb file...


Hello,

I have a cdb file called data.cdb stored into my PocketPC. Below is my
code, I am using msgbox for debugging purpose:

' Here we I do all the necessary coding to display the contents in
Dim strHandHeld As String = TheReaderData.Text
Dim Conn As New SqlConnection("User
ID=DSUSER;PASSWORD=silentk;Data Source=NTSERVER-2;Initial
Catalog=Direct Source System;Persist Security Info=False;Packet
Size=4096")
Dim objDataReader As SqlDataReader = Nothing
Dim myCommand As New SqlCommand()
Dim strSQL As String = "SELECT Item_Number FROM Product WHERE
UPC = '" & Mid(strHandHeld, 1, 1) & " " & Mid(strHandHeld, 2, 5) & " "
& Mid(strHandHeld, 7, 5) & " " & Mid(strHandHeld, 12, 1) & "'"
txtUPC.Text = Mid(strHandHeld, 1, 1) & " " & Mid(strHandHeld,
2, 5) & " " & Mid(strHandHeld, 7, 5) & " " & Mid(strHandHeld, 12, 1)
Dim strLocation As String = ""
MsgBox("1")
Dim objSQLCeCommand As System.Data.SqlServerCe.SqlCeCommand =
Nothing
MsgBox("2")
Dim objSQLCeConnection As New
System.Data.SqlServerCe.SqlCeConnection("Data Source=\Data.cdb")
MsgBox("3")
Dim objSQLCeDataReader As
System.Data.SqlServerCe.SqlCeDataReader = Nothing
MsgBox("4")
objSQLCeConnection.Open()
MsgBox("5")
objSQLCeCommand = New
System.Data.SqlServerCe.SqlCeCommand(strSQL, objSQLCeConnection)
MsgBox("6: " & strSQL)
objSQLCeDataReader = objSQLCeCommand.ExecuteReader
MsgBox("7: " & objSQLCeCommand.ExecuteReader.Read)
MsgBox(objSQLCeDataReader("Item_Number"))
MsgBox("8")
objSQLCeConnection.Close()
MsgBox("9")
MsgBox("Arrived safely")

Anyways as soon as the line hits for number 4 it refuses to open the
connection...this is how I am connecting to my data.cdb:

Dim objSQLCeConnection As New
System.Data.SqlServerCe.SqlCeConnection("Data Source=\Data.cdb")

is this wrong? If so how do I connect to my .cdb file in my PocketPC?
Thanks, appreciate it big time.

  Reply With Quote
Old 05-12-2006, 05:01 PM   #2
Guest
 
Posts: n/a
Default Re: connect to my cdb file...

CDB files are not SQL CE files, so the SqlCE classes cannot open them. CDBs
are a deprecated Pocket Access format and there are no built-in managed
libraries for talking to them. InTheHand does have a commercial solution
that works well.


--
Chris Tacke
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com
--


<amiga500@gmail.com> wrote in message
news:1165337765.591611.23050@80g2000cwy.googlegroups.com...
> Hello,
>
> I have a cdb file called data.cdb stored into my PocketPC. Below is my
> code, I am using msgbox for debugging purpose:
>
> ' Here we I do all the necessary coding to display the contents in
> Dim strHandHeld As String = TheReaderData.Text
> Dim Conn As New SqlConnection("User
> ID=DSUSER;PASSWORD=silentk;Data Source=NTSERVER-2;Initial
> Catalog=Direct Source System;Persist Security Info=False;Packet
> Size=4096")
> Dim objDataReader As SqlDataReader = Nothing
> Dim myCommand As New SqlCommand()
> Dim strSQL As String = "SELECT Item_Number FROM Product WHERE
> UPC = '" & Mid(strHandHeld, 1, 1) & " " & Mid(strHandHeld, 2, 5) & " "
> & Mid(strHandHeld, 7, 5) & " " & Mid(strHandHeld, 12, 1) & "'"
> txtUPC.Text = Mid(strHandHeld, 1, 1) & " " & Mid(strHandHeld,
> 2, 5) & " " & Mid(strHandHeld, 7, 5) & " " & Mid(strHandHeld, 12, 1)
> Dim strLocation As String = ""
> MsgBox("1")
> Dim objSQLCeCommand As System.Data.SqlServerCe.SqlCeCommand =
> Nothing
> MsgBox("2")
> Dim objSQLCeConnection As New
> System.Data.SqlServerCe.SqlCeConnection("Data Source=\Data.cdb")
> MsgBox("3")
> Dim objSQLCeDataReader As
> System.Data.SqlServerCe.SqlCeDataReader = Nothing
> MsgBox("4")
> objSQLCeConnection.Open()
> MsgBox("5")
> objSQLCeCommand = New
> System.Data.SqlServerCe.SqlCeCommand(strSQL, objSQLCeConnection)
> MsgBox("6: " & strSQL)
> objSQLCeDataReader = objSQLCeCommand.ExecuteReader
> MsgBox("7: " & objSQLCeCommand.ExecuteReader.Read)
> MsgBox(objSQLCeDataReader("Item_Number"))
> MsgBox("8")
> objSQLCeConnection.Close()
> MsgBox("9")
> MsgBox("Arrived safely")
>
> Anyways as soon as the line hits for number 4 it refuses to open the
> connection...this is how I am connecting to my data.cdb:
>
> Dim objSQLCeConnection As New
> System.Data.SqlServerCe.SqlCeConnection("Data Source=\Data.cdb")
>
> is this wrong? If so how do I connect to my .cdb file in my PocketPC?
> Thanks, appreciate it big time.
>



  Reply With Quote
Old 05-12-2006, 05:14 PM   #3
amiga500@gmail.com
Guest
 
Posts: n/a
Default Re: connect to my cdb file...

Are you telling me there are absolutely no alternative what so ever but
to get a third party program to do this?

On Dec 5, 12:01 pm, "<ctacke/>" <ctacke[@]opennetcf[dot]com> wrote:
> CDB files are not SQL CE files, so the SqlCE classes cannot open them. CDBs
> are a deprecated Pocket Access format and there are no built-in managed
> libraries for talking to them. InTheHand does have a commercial solution
> that works well.
>
> --
> Chris Tacke
> OpenNETCF Consulting
> Managed Code in the Embedded Worldwww.opennetcf.com
> --
>
> <amiga...@gmail.com> wrote in messagenews:1165337765.591611.23050@80g2000cwy.googlegroups.com...
>
> > Hello,

>
> > I have a cdb file called data.cdb stored into my PocketPC. Below is my
> > code, I am using msgbox for debugging purpose:

>
> > ' Here we I do all the necessary coding to display the contents in
> > Dim strHandHeld As String = TheReaderData.Text
> > Dim Conn As New SqlConnection("User
> > ID=DSUSER;PASSWORD=silentk;Data Source=NTSERVER-2;Initial
> > Catalog=Direct Source System;Persist Security Info=False;Packet
> > Size=4096")
> > Dim objDataReader As SqlDataReader = Nothing
> > Dim myCommand As New SqlCommand()
> > Dim strSQL As String = "SELECT Item_Number FROM Product WHERE
> > UPC = '" & Mid(strHandHeld, 1, 1) & " " & Mid(strHandHeld, 2, 5) & " "
> > & Mid(strHandHeld, 7, 5) & " " & Mid(strHandHeld, 12, 1) & "'"
> > txtUPC.Text = Mid(strHandHeld, 1, 1) & " " & Mid(strHandHeld,
> > 2, 5) & " " & Mid(strHandHeld, 7, 5) & " " & Mid(strHandHeld, 12, 1)
> > Dim strLocation As String = ""
> > MsgBox("1")
> > Dim objSQLCeCommand As System.Data.SqlServerCe.SqlCeCommand =
> > Nothing
> > MsgBox("2")
> > Dim objSQLCeConnection As New
> > System.Data.SqlServerCe.SqlCeConnection("Data Source=\Data.cdb")
> > MsgBox("3")
> > Dim objSQLCeDataReader As
> > System.Data.SqlServerCe.SqlCeDataReader = Nothing
> > MsgBox("4")
> > objSQLCeConnection.Open()
> > MsgBox("5")
> > objSQLCeCommand = New
> > System.Data.SqlServerCe.SqlCeCommand(strSQL, objSQLCeConnection)
> > MsgBox("6: " & strSQL)
> > objSQLCeDataReader = objSQLCeCommand.ExecuteReader
> > MsgBox("7: " & objSQLCeCommand.ExecuteReader.Read)
> > MsgBox(objSQLCeDataReader("Item_Number"))
> > MsgBox("8")
> > objSQLCeConnection.Close()
> > MsgBox("9")
> > MsgBox("Arrived safely")

>
> > Anyways as soon as the line hits for number 4 it refuses to open the
> > connection...this is how I am connecting to my data.cdb:

>
> > Dim objSQLCeConnection As New
> > System.Data.SqlServerCe.SqlCeConnection("Data Source=\Data.cdb")

>
> > is this wrong? If so how do I connect to my .cdb file in my PocketPC?
> > Thanks, appreciate it big time.


  Reply With Quote
Old 05-12-2006, 05:25 PM   #4
Paul G. Tobey [eMVP]
Guest
 
Posts: n/a
Default Re: connect to my cdb file...

There's always some alternative, but not necessarily a practical one. You
could wrap the deprecated API yourself.

Paul T.

<amiga500@gmail.com> wrote in message
news:1165338880.976222.107970@79g2000cws.googlegroups.com...
> Are you telling me there are absolutely no alternative what so ever but
> to get a third party program to do this?
>
> On Dec 5, 12:01 pm, "<ctacke/>" <ctacke[@]opennetcf[dot]com> wrote:
>> CDB files are not SQL CE files, so the SqlCE classes cannot open them.
>> CDBs
>> are a deprecated Pocket Access format and there are no built-in managed
>> libraries for talking to them. InTheHand does have a commercial solution
>> that works well.
>>
>> --
>> Chris Tacke
>> OpenNETCF Consulting
>> Managed Code in the Embedded Worldwww.opennetcf.com
>> --
>>
>> <amiga...@gmail.com> wrote in
>> messagenews:1165337765.591611.23050@80g2000cwy.googlegroups.com...
>>
>> > Hello,

>>
>> > I have a cdb file called data.cdb stored into my PocketPC. Below is my
>> > code, I am using msgbox for debugging purpose:

>>
>> > ' Here we I do all the necessary coding to display the contents in
>> > Dim strHandHeld As String = TheReaderData.Text
>> > Dim Conn As New SqlConnection("User
>> > ID=DSUSER;PASSWORD=silentk;Data Source=NTSERVER-2;Initial
>> > Catalog=Direct Source System;Persist Security Info=False;Packet
>> > Size=4096")
>> > Dim objDataReader As SqlDataReader = Nothing
>> > Dim myCommand As New SqlCommand()
>> > Dim strSQL As String = "SELECT Item_Number FROM Product WHERE
>> > UPC = '" & Mid(strHandHeld, 1, 1) & " " & Mid(strHandHeld, 2, 5) & " "
>> > & Mid(strHandHeld, 7, 5) & " " & Mid(strHandHeld, 12, 1) & "'"
>> > txtUPC.Text = Mid(strHandHeld, 1, 1) & " " & Mid(strHandHeld,
>> > 2, 5) & " " & Mid(strHandHeld, 7, 5) & " " & Mid(strHandHeld, 12, 1)
>> > Dim strLocation As String = ""
>> > MsgBox("1")
>> > Dim objSQLCeCommand As System.Data.SqlServerCe.SqlCeCommand =
>> > Nothing
>> > MsgBox("2")
>> > Dim objSQLCeConnection As New
>> > System.Data.SqlServerCe.SqlCeConnection("Data Source=\Data.cdb")
>> > MsgBox("3")
>> > Dim objSQLCeDataReader As
>> > System.Data.SqlServerCe.SqlCeDataReader = Nothing
>> > MsgBox("4")
>> > objSQLCeConnection.Open()
>> > MsgBox("5")
>> > objSQLCeCommand = New
>> > System.Data.SqlServerCe.SqlCeCommand(strSQL, objSQLCeConnection)
>> > MsgBox("6: " & strSQL)
>> > objSQLCeDataReader = objSQLCeCommand.ExecuteReader
>> > MsgBox("7: " & objSQLCeCommand.ExecuteReader.Read)
>> > MsgBox(objSQLCeDataReader("Item_Number"))
>> > MsgBox("8")
>> > objSQLCeConnection.Close()
>> > MsgBox("9")
>> > MsgBox("Arrived safely")

>>
>> > Anyways as soon as the line hits for number 4 it refuses to open the
>> > connection...this is how I am connecting to my data.cdb:

>>
>> > Dim objSQLCeConnection As New
>> > System.Data.SqlServerCe.SqlCeConnection("Data Source=\Data.cdb")

>>
>> > is this wrong? If so how do I connect to my .cdb file in my PocketPC?
>> > Thanks, appreciate it big time.

>



  Reply With Quote
Old 05-12-2006, 05:27 PM   #5
Guest
 
Posts: n/a
Default Re: connect to my cdb file...

No. If it *must* be a CDB then you have 2 options:
1. Use a third-party library
2. Write your own library P/Invoking the system APIs to talk to the CDB.

#2 is a lot of work, which is why the 3rd party libraries exist in the first
place.

If the CDB is not a requirement, then you could use a number of other better
supported database formats, like SQL CE/Mobile/Everywhere/Anywhere or MySQL.


--
Chris Tacke
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com
--


<amiga500@gmail.com> wrote in message
news:1165338880.976222.107970@79g2000cws.googlegroups.com...
> Are you telling me there are absolutely no alternative what so ever but
> to get a third party program to do this?
>
> On Dec 5, 12:01 pm, "<ctacke/>" <ctacke[@]opennetcf[dot]com> wrote:
>> CDB files are not SQL CE files, so the SqlCE classes cannot open them.
>> CDBs
>> are a deprecated Pocket Access format and there are no built-in managed
>> libraries for talking to them. InTheHand does have a commercial solution
>> that works well.
>>
>> --
>> Chris Tacke
>> OpenNETCF Consulting
>> Managed Code in the Embedded Worldwww.opennetcf.com
>> --
>>
>> <amiga...@gmail.com> wrote in
>> messagenews:1165337765.591611.23050@80g2000cwy.googlegroups.com...
>>
>> > Hello,

>>
>> > I have a cdb file called data.cdb stored into my PocketPC. Below is my
>> > code, I am using msgbox for debugging purpose:

>>
>> > ' Here we I do all the necessary coding to display the contents in
>> > Dim strHandHeld As String = TheReaderData.Text
>> > Dim Conn As New SqlConnection("User
>> > ID=DSUSER;PASSWORD=silentk;Data Source=NTSERVER-2;Initial
>> > Catalog=Direct Source System;Persist Security Info=False;Packet
>> > Size=4096")
>> > Dim objDataReader As SqlDataReader = Nothing
>> > Dim myCommand As New SqlCommand()
>> > Dim strSQL As String = "SELECT Item_Number FROM Product WHERE
>> > UPC = '" & Mid(strHandHeld, 1, 1) & " " & Mid(strHandHeld, 2, 5) & " "
>> > & Mid(strHandHeld, 7, 5) & " " & Mid(strHandHeld, 12, 1) & "'"
>> > txtUPC.Text = Mid(strHandHeld, 1, 1) & " " & Mid(strHandHeld,
>> > 2, 5) & " " & Mid(strHandHeld, 7, 5) & " " & Mid(strHandHeld, 12, 1)
>> > Dim strLocation As String = ""
>> > MsgBox("1")
>> > Dim objSQLCeCommand As System.Data.SqlServerCe.SqlCeCommand =
>> > Nothing
>> > MsgBox("2")
>> > Dim objSQLCeConnection As New
>> > System.Data.SqlServerCe.SqlCeConnection("Data Source=\Data.cdb")
>> > MsgBox("3")
>> > Dim objSQLCeDataReader As
>> > System.Data.SqlServerCe.SqlCeDataReader = Nothing
>> > MsgBox("4")
>> > objSQLCeConnection.Open()
>> > MsgBox("5")
>> > objSQLCeCommand = New
>> > System.Data.SqlServerCe.SqlCeCommand(strSQL, objSQLCeConnection)
>> > MsgBox("6: " & strSQL)
>> > objSQLCeDataReader = objSQLCeCommand.ExecuteReader
>> > MsgBox("7: " & objSQLCeCommand.ExecuteReader.Read)
>> > MsgBox(objSQLCeDataReader("Item_Number"))
>> > MsgBox("8")
>> > objSQLCeConnection.Close()
>> > MsgBox("9")
>> > MsgBox("Arrived safely")

>>
>> > Anyways as soon as the line hits for number 4 it refuses to open the
>> > connection...this is how I am connecting to my data.cdb:

>>
>> > Dim objSQLCeConnection As New
>> > System.Data.SqlServerCe.SqlCeConnection("Data Source=\Data.cdb")

>>
>> > is this wrong? If so how do I connect to my .cdb file in my PocketPC?
>> > Thanks, appreciate it big time.

>



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off