Any Suggestions on how to do a multiple change to data?

M

Mr. B

I'm open to suggestions on how to accomplish this easily (VB.net... MS
Access):

I've an MS Access db. It has a column indicating if the row has been Exported
or not (the Column is a Boolean).

What I'm trying to figure out is how to toggle the Boolean flag for several
rows at a time.

For example, if I do a Search for a Week-Ending date (ie a date of
23/12/2005), I would lile to be able (via a button) to toggle all of those
rows with that week-ending date to be 1 (or True).

In my application I can display the selected rows in a DataGrid and make
changes there by using a DataSet and Fill with specific search criteria and
Binding the DataSet to a DataGrid. But I want to know how to do this without
having to manually change _each_ Boolean per row.

Any thoughts much appreciated!

Mr. B
 
R

Ralph

Mr. B said:
I'm open to suggestions on how to accomplish this easily (VB.net... MS
Access):

I've an MS Access db. It has a column indicating if the row has been Exported
or not (the Column is a Boolean).

What I'm trying to figure out is how to toggle the Boolean flag for several
rows at a time.

For example, if I do a Search for a Week-Ending date (ie a date of
23/12/2005), I would lile to be able (via a button) to toggle all of those
rows with that week-ending date to be 1 (or True).

In my application I can display the selected rows in a DataGrid and make
changes there by using a DataSet and Fill with specific search criteria and
Binding the DataSet to a DataGrid. But I want to know how to do this without
having to manually change _each_ Boolean per row.

Any thoughts much appreciated!

Mr. B

--
<response type="generic" language="VB.Net">
This newsgroup is for users of Visual Basic version 6.0
and earlier and not the misleadingly named VB.Net
or VB 200x. Solutions, and often even the questions,
for one platform will be meaningless in the other.
When VB.Net was released Microsoft created new newsgroups
devoted to the new platform so that neither group of
developers need wade through the clutter of unrelated
topics. Look for newsgroups with the words "dotnet" or
"vsnet" in their name. For the msnews.microsoft.com news
server try these:

news://msnews.microsoft.com/
microsoft.public.dotnet.general
microsoft.public.dotnet.languages.vb
microsoft.public.dotnet.languages.vb.data
microsoft.public.dotnet.framework.adonet
microsoft.public.dotnet.framework.windowsforms.controls
microsoft.public.dotnet.framework.windowsforms.databinding
microsoft.public.vsnet.general
microsoft.public.vstudio.general
</response>
 
S

Stephen Howe

I'm open to suggestions on how to accomplish this easily (VB.net... MS

Please don't cross post to non-relevant newsgroups.

microsoft.public.data.ado
microsoft.public.vb.database.ado

are for classic ADO, pre-.NET (and anyone else developing .NET apps: _DONT_
bother posting to these newsgroups)

Stephen Howe
 
M

Mr. B

Despit your 'reply' I've posted ADO.net/VB.net questions in these NG's in past
WITHOUT anyone making any static on my POSTS... Thus I'll continue to post
here as I do believe them to be 'relevant'.

B
 
D

Douglas J. Steele

Hopefully you're prepared to keep being told you're posting inappropriately.

However, you need an Update query for what you're doing.
 
M

Mr. B

Hopefully you're prepared to keep being told you're posting inappropriately.

However, you need an Update query for what you're doing.

No doubt... but like I said, I've done such posting many time before without
anyone commenting.

But thanks for your tip. I'll see what I can find on that.

B
 
S

Stephen Howe

Despit your 'reply' I've posted ADO.net/VB.net questions in these NG's in
past
WITHOUT anyone making any static on my POSTS...

You got lucky.
Thus I'll continue to post here as I do believe them to be 'relevant'.

Believing does not matter you selfish git. The newsgroups _ARE_ for classic
ADO.
There are newsgroups specifically for .NET as you well know, even one
devoted to the datagrid.

I will make sure I dont answer any of your questions.

Stephen Howe
 
P

Paul Clement

¤ I'm open to suggestions on how to accomplish this easily (VB.net... MS
¤ Access):
¤
¤ I've an MS Access db. It has a column indicating if the row has been Exported
¤ or not (the Column is a Boolean).
¤
¤ What I'm trying to figure out is how to toggle the Boolean flag for several
¤ rows at a time.
¤
¤ For example, if I do a Search for a Week-Ending date (ie a date of
¤ 23/12/2005), I would lile to be able (via a button) to toggle all of those
¤ rows with that week-ending date to be 1 (or True).
¤
¤ In my application I can display the selected rows in a DataGrid and make
¤ changes there by using a DataSet and Fill with specific search criteria and
¤ Binding the DataSet to a DataGrid. But I want to know how to do this without
¤ having to manually change _each_ Boolean per row.
¤
¤ Any thoughts much appreciated!

I don't believe there is a direct way to do this in a DataGrid or DataSet.

About the only method you can use is a SQL Update statement, to change this flag for the rows in the
underlying table of your database, based upon the criteria (Date) you specify. You would then need
to rebuild your DataSet and DataGrid to display the updated rows.


Paul
~~~~
Microsoft MVP (Visual Basic)
 
B

Branden Johnson

Here is the VB6 version of what you want to accomplish:

Place a button on your form, and name it "cmdUpdate"...

Private Sub cmdUpdate_Click()
Dim sqlUpdate As String
Dim con As New ADODB.Connection
Dim iRecAff As Long

sqlUpdate = "" & _
"UPDATE " & _
"TABLENAME " & _
"SET " & _
"EXPORTED = TRUE " & _
"WHERE " & _
"WEEK_ENDDATE = CDATE('12/23/2005')"

With con
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\MyDatabase.mdb;Persist Security Info=False"
.Open
End With

con.Execute sqlUpdate, iRecAff

If iRecAff > 0 Then MsgBox iRecAff & " records sucessfully updated.",
vbInformation, "Record(s) Update"

con.Close
Set con = Nothing
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top