473,387 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

read sql record into memory, use/modify fields then save changes

cj
How is the best way to return a single record via sql query that will
result in me being able to read and change the values of the individual
fields as needed as I proceed through a section of code?

Once this section of code is completed that record's changed will need
to be flushed back to the table it was pulled from. This process will
NOT involve a user interface.

I've written queries to get info for a datagrid before and I've written
queries to update records before but storing and reading/changing a
record then flushing it back is new to me in VB.

I'm using VB 2008.
Mar 25 '08 #1
2 1197
On Mar 25, 2:31*pm, cj <c...@nospam.nospamwrote:
How is the best way to return a single record via sql query that will
result in me being able to read and change the values of the individual
fields as needed as I proceed through a section of code?

Once this section of code is completed that record's changed will need
to be flushed back to the table it was pulled from. *This process will
NOT involve a user interface.

I've written queries to get info for a datagrid before and I've written
queries to update records before but storing and reading/changing a
record then flushing it back is new to me in VB.

I'm using VB 2008.
SQLDataAdaptor maybe?
Mar 25 '08 #2
cj,
A simple sqlConnection that has the Select statement and the connection
A simple datatable that you get with fill
A simple sqlCommandbuilder which you let get the information from that
\\\
dim cmd as new SqlCommandBuilder(yourdatadapter)
///
A a simple update with the same tableadapter with the changed row
And you are ready.
Another approach is creatinging an SQL Datareader with the same select
statement
To read one row
To create an SQL transact statement (which is mostly the most time consuming
in SQL transact code)
set all the parameters (the other bunch of work)
create an command (with the update command)
do an command.executenonquerry
A third approach probably most simple is
Create a datacontext (dbml)
Create a Linq statement to select the data
do a datacontext submitchanges

There are more

Cor
"cj" <cj@nospam.nospamschreef in bericht
news:OT**************@TK2MSFTNGP04.phx.gbl...
How is the best way to return a single record via sql query that will
result in me being able to read and change the values of the individual
fields as needed as I proceed through a section of code?

Once this section of code is completed that record's changed will need to
be flushed back to the table it was pulled from. This process will NOT
involve a user interface.

I've written queries to get info for a datagrid before and I've written
queries to update records before but storing and reading/changing a record
then flushing it back is new to me in VB.

I'm using VB 2008.
Mar 26 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Frances | last post by:
Hi All, I'm having a problem trying to add a record to a simple Access 2000 db (db is very similar to an address book but with more info than the usual address, phone, etc.). The database is...
2
by: RC | last post by:
I am getting the following error message. "Write Conflict this record has been changed by another user since you started edting it. If you save the record, you will overwrite the changes...." I...
6
by: sghi | last post by:
Hi All, I'm new to this group and quite new to access/vba. So, shortly after beginning to write a simple application for my wife, I came across a blocking problem: I need to intercept the sql...
4
by: lesperancer | last post by:
it looks like this will save many versions of a relationship window, but based on the fact that the same tables are displayed in the relationship window and it will restore versions of what was...
7
by: Dale Sampson | last post by:
As you can tell, I am new to VS.net. I have a VB project with a defined data source pointing to a table in a ..mdb file.-- The associated fields are displayed in textboxes using the...
10
by: Phil Stanton | last post by:
There are various hidden tables in Acees 2000 including MSysACEs The owner in Engine (I presume the Microsoft Jet Engine); I can't read the data or change the permissions. Any ideas Thanks ...
1
by: Cesar Zapata | last post by:
Hi, I have a a bound subform and what i'm trying to do is do check if some criteria applies before saving the record and trigger a macro. basically this is what I got. Date Received ...
10
by: sara | last post by:
Hi - I have been struggling with solution ideas for this now for almost 2 weeks, and have not been able to figure this out. I have a user who creates a Purchase Order (tblPOData). In some...
5
by: =?Utf-8?B?bXBhaW5l?= | last post by:
Hello, I am completely lost as to why I can't update a DropDownList inside a DetailsView after I perform an insert into an object datasource. I tried to simply it down to the core demostration:...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.