473,396 Members | 1,714 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,396 software developers and data experts.

A desperate help in Update

Hello! Experts,

I have the following piece of code in VB.NET that I want to use to
update any records in the database. I would like to use a code as well
as DataGrid to update the records. Please guide me how can I achieve
it. I know there is an Update command to to do this that but since I
am a newbie I don't know how? I'll be really grateful to those who may
help me buy modifying the following code. I am really desperately
looking for your help. I know this will only take a fraction of your
time but it will be a very big help for me. Thanks to all...

------------------------------------------------------------------------
Private odbcAd As New Microsoft.Data.Odbc.OdbcDataAdapter
Private Conn As New Microsoft.Data.Odbc.OdbcConnection
Private ds As New DataSet("AnyTable")

Conn.ConnectionString = "DSN=TestDSN"

Conn.Open()

Dim SQL As String
SQL = "SELECT * FROM AnyTable"

odbcAd = New Microsoft.Data.Odbc.OdbcDataAdapter(SQL, Conn)

ds.Clear()

odbcAd.Fill(ds, "AnyTable")

DataGrid1.SetDataBinding(ds, "AnyTable")

ds.Tables("AnyTable").Rows(1).Item(3) = "Test"
------------------------------------------------------------
Nov 20 '05 #1
1 1700
Hello -

You need to call the Update method of your DataAdapter. Check out this help
topic:

Updating a Data Source with a Dataset (Visual Basic and Visual C# Concepts)
http://msdn.microsoft.com/library/en...mingUpdates.as
p
hope that helps
Steve Stein
VB Team

This posting is provided "AS IS" with no warranties and confers no rights.

--------------------
From: sa*********@yahoo.com (Sajid)
Newsgroups: microsoft.public.dotnet.languages.vb.data,microsof t.public.dotnet.languages.
vbSubject: A desperate help in Update
Date: 27 Jan 2004 11:18:46 -0800
Organization: http://groups.google.com
Lines: 33
Message-ID: <e0**************************@posting.google.com >
NNTP-Posting-Host: 195.13.97.12
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: posting.google.com 1075231126 22381 127.0.0.1 (27 Jan 2004 19:18:46 GMT)X-Complaints-To: gr**********@google.com
NNTP-Posting-Date: Tue, 27 Jan 2004 19:18:46 +0000 (UTC)
Path: cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTN GP08.phx.gbl!news-out.cwix
..com!newsfeed.cwix.com!news.maxwell.syr.edu!postn ews1.google.com!not-for-mai
lXref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.languages.vb:176578 microsoft.public.dotnet.languages.vb.data:2998X-Tomcat-NG: microsoft.public.dotnet.languages.vb

Hello! Experts,

I have the following piece of code in VB.NET that I want to use to
update any records in the database. I would like to use a code as well
as DataGrid to update the records. Please guide me how can I achieve
it. I know there is an Update command to to do this that but since I
am a newbie I don't know how? I'll be really grateful to those who may
help me buy modifying the following code. I am really desperately
looking for your help. I know this will only take a fraction of your
time but it will be a very big help for me. Thanks to all...

------------------------------------------------------------------------
Private odbcAd As New Microsoft.Data.Odbc.OdbcDataAdapter
Private Conn As New Microsoft.Data.Odbc.OdbcConnection
Private ds As New DataSet("AnyTable")

Conn.ConnectionString = "DSN=TestDSN"

Conn.Open()

Dim SQL As String
SQL = "SELECT * FROM AnyTable"

odbcAd = New Microsoft.Data.Odbc.OdbcDataAdapter(SQL, Conn)

ds.Clear()

odbcAd.Fill(ds, "AnyTable")

DataGrid1.SetDataBinding(ds, "AnyTable")

ds.Tables("AnyTable").Rows(1).Item(3) = "Test"
------------------------------------------------------------


Nov 20 '05 #2

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

Similar topics

3
by: James | last post by:
Please help - getting very desperate! Sun, 12 October 2003 05:39 I have PHPDEV 4.2.3 from Firepages.com.au as the upgrade to 4.3.0 did not work. I also had an abortive download from PHP.NET as...
0
by: Somerset Bob | last post by:
I've posted my query at the phpbb forum, where I got half an answer and then no more. I posted it again at another phpbb forum, where I got half an answer and no more. I posted it in alt.php, where...
0
by: Somerset Bob | last post by:
I've posted my query at the phpbb forum, where I got half an answer and then no more. I posted it again at another phpbb forum, where I got half an answer and no more. I posted it in alt.php, where...
9
by: DD | last post by:
Hello, Could anyone please help me?? Is there somebody who could explain me how to make a connection to a access database with a python cgi script. I would like to use common sql commands in my...
5
by: Tank | last post by:
I have had this post up here when i was trying to figure out how to make leading zeros and have been able to fudge that to work. I am now have trouble getting the loop that makes the folders to...
24
by: Ministry Of Jute | last post by:
I returned home from work today to find an Airborne Express Letter Express mailer leaning up against my apartment door. The return addressee was Microsoft Suite 300 1165 Eastlake Avenue E...
1
by: wolfiecat | last post by:
Hello - I am new to this forum. Let me start off by saying that I have never used ASP before. I am working on a project where the site was already created using frames and .aspx pages. I was...
2
by: quortex | last post by:
Hi all, I have written a web service using the .net framework 2 and Visual Studio 2005. I consume the managed service by native C++ using the "add web reference" feature. This obviously shells...
6
by: Timmy! | last post by:
Access 2003. Will someone please explain how to do this? My applications have all become so absolutely despairingly *&^%ing corrupted - I have no idea why - I honestly suspect some asinine XP...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.