Skip to main content

VB.Net SQL CE - UPDATE & SELECT Queries

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [.NET Compact Framework Development] >> .NET Compact Framework - VB.NET >> VB.Net SQL CE - UPDATE & SELECT Queries Page: [1]
Login
Message << Older Topic   Newer Topic >>
VB.Net SQL CE - UPDATE & SELECT Queries - 11/5/2004 9:32:55 AM   
Wes

 

Posts: 104
Score: 0
Joined: 2/5/2003
Status: offline
Hi,

im making the switch from eVB to VB.Net .... please be patient!

can anyone give me some sample code for an UPDATE or SELECT Query on a SQL CE Database in VB.NET

I have code for INSERT as follows...
'Create the insertRow command on the connection.
Dim insertRow As SqlCeCommand = ssceconn.CreateCommand()
insertRow.CommandText = "INSERT INTO People(f_name, l_name) VALUES ('John', 'Doe')"

Many Thanks,
Wes
Post #: 1
RE: VB.Net SQL CE - UPDATE & SELECT Queries - 11/5/2004 10:47:11 AM   
Wes

 

Posts: 104
Score: 0
Joined: 2/5/2003
Status: offline
I have found some code that will perform an update & select query. They use "SqlCeCommand".

Imports System.Data.SqlServerCe

Private Sub btnTestClick()
Dim strSQLStatement As String
Dim oConn As SqlCeConnection
Dim oCmd As SqlCeCommand
Dim strDB As String

strSQLStatement = "INSERT YOUR SQL QUERY HERE"

Try
oConn = New SqlCeConnection("Data Source=\Program Files\database.sdf")
oCmd = New SqlCeCommand(strSQLStatement.Trim, oConn)
oConn.Open()
If oCmd.ExecuteNonQuery >= 0 Then
MessageBox.Show("Query Executed OK")
End If
oConn.Close()
Catch oErr As SqlCeException
MessageBox.Show(oErr.Message)
Finally
If Not IsNothing(oConn) Then
If oConn.State = ConnectionState.Open Then
oConn.Close()
End If
End If
End Try
End Sub

(in reply to Wes)
Post #: 2
Page:   [1]
All Forums >> [.NET Compact Framework Development] >> .NET Compact Framework - VB.NET >> VB.Net SQL CE - UPDATE & SELECT Queries Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Forum Software © ASPPlayground.NET Advanced Edition 2.5.5 Unicode

0.031