List View Question??

  • Thread starter Thread starter MarcMc
  • Start date Start date
M

MarcMc

Help me out here please, List Views? I've got 2 check
boxes. When the focus is on a particular record in the
List View, I want it to update using the following SQL.
Are there any methods that will allow me to populate a
variable with the particular list view record which has
focus and can i then use it in the update statment instead
of hardcoded WHERE CUSTNMBR = 'CUST02'


Private Sub btnJPSave_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
btnJPSave.Click

If lstJP.FocusedItem.Text <> "" And ckboxJPCalled.Checked
And ckBoxJPOrdered.Checked Then
Dim cn As New SqlCeConnection("Data Source = " &
txtDataSource.Text)
Dim strUpdate As String = " UPDATE JourneyPlan set " & _
" Called = 'Y', Ordered = 'Y' "
& _ " WHERE CUSTNMBR = 'CUST02' "


I tried this but it don't work ... any ideas?
Dim marc1 As DataRow
marc1 = lstJP.Items(lstJP.FocusedItem)
 
Hi Marc,

Sounds like what you want is a parameterized query. See the sample on
MSDN at:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_evtuv/ht
ml/etconwalkthroughcreatingsqlservercedatabase.asp

Hope this helps,

Scott

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| Content-Class: urn:content-classes:message
| From: "MarcMc" <[email protected]>
| Sender: "MarcMc" <[email protected]>
| Subject: List View Question??
| Date: Tue, 22 Jul 2003 09:22:21 -0700
| Lines: 26
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcNQbW1b9s0rzerVT1WzNzYPfrp9CA==
| Newsgroups: microsoft.public.dotnet.framework.compactframework
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.compactframework:28832
| NNTP-Posting-Host: TK2MSFTNGXA09 10.40.1.161
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
|
| Help me out here please, List Views? I've got 2 check
| boxes. When the focus is on a particular record in the
| List View, I want it to update using the following SQL.
| Are there any methods that will allow me to populate a
| variable with the particular list view record which has
| focus and can i then use it in the update statment instead
| of hardcoded WHERE CUSTNMBR = 'CUST02'
|
|
| Private Sub btnJPSave_Click(ByVal sender As
| System.Object, ByVal e As System.EventArgs) Handles
| btnJPSave.Click
|
| If lstJP.FocusedItem.Text <> "" And ckboxJPCalled.Checked
| And ckBoxJPOrdered.Checked Then
| Dim cn As New SqlCeConnection("Data Source = " &
| txtDataSource.Text)
| Dim strUpdate As String = " UPDATE JourneyPlan set " & _
| " Called = 'Y', Ordered = 'Y' "
| & _ " WHERE CUSTNMBR = 'CUST02' "
|
|
| I tried this but it don't work ... any ideas?
| Dim marc1 As DataRow
| marc1 = lstJP.Items(lstJP.FocusedItem)
|
|
 
Back
Top