473,508 Members | 2,331 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Saving data to SQL Data Base

Hi,
I'm using the following code to open a data base and show it's content
in a Data Grid View
----
Code
-----
Imports System.Data.SqlClient

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Dim conn As New SqlConnection("Data
Source=./wideserver;Path="c:/cct.mdf";User
Id=username;Password=Password;")
Using (conn)
conn.Open()
Dim com As SqlCommand = conn.CreateCommand()
Using (com)
com.CommandType = CommandType.Text

com.CommandText = "Select * From users"
Dim da As New SqlDataAdapter(com)
Using (da)
Dim dt As New DataTable("usertable")
Using (dt)
da.Fill(dt)
Dim dgv As New DataGridView()
dgv.Dock = DockStyle.Fill
dgv.DataSource = dt
Me.Controls.Add(dgv)
End Using
End Using
End Using
End Using
End Sub
-----
end code
-----

The following code allow me to see the table data in a Data Grid View
but now i want to save the changes in the table (after making
modifications in the dgv)
i use : dta.update(dt)
but that don't work !!!!!!
Any Help and thanks a lot
Omar Abid
www.omarabid.uni.cc

Aug 10 '07 #1
2 2837
Omar Abid (om***********@gmail.com) writes:
Thanks for your reply. I'm new to SQL and just learning. Do you direct
links (that contain specific thing that i need)
If so post those links
If you are to work with ADO .Net, you need to learn to with MSDN Library,
either on disk or on the web.

The link for the .UpdateCommand property in MSDN Library is
ms-
help://MS.MSDNQTR.v80.en/MS.MSDN.v80/MS.NETDEVFX.v20.en/cpref10/html/P_Syste
m_Data_SqlClient_SqlDataAdapter_UpdateCommand.htm

If you are new to ADO .Net in general and want a head start, I recommend
David Sceppa's "ADO .Net Core Reference".
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Aug 14 '07 #2
On Aug 14, 2:29 pm, Erland Sommarskog <esq...@sommarskog.sewrote:
Omar Abid (omar.abid2...@gmail.com) writes:
Thanks for your reply. I'm new to SQL and just learning. Do you direct
links (that contain specific thing that i need)
If so post those links

If you are to work with ADO .Net, you need to learn to with MSDN Library,
either on disk or on the web.

The link for the .UpdateCommand property in MSDN Library is
ms-
help://MS.MSDNQTR.v80.en/MS.MSDN.v80/MS.NETDEVFX.v20.en/cpref10/html/P_Syste
m_Data_SqlClient_SqlDataAdapter_UpdateCommand.htm

If you are new to ADO .Net in general and want a head start, I recommend
David Sceppa's "ADO .Net Core Reference".

--
Erland Sommarskog, SQL Server MVP, esq...@sommarskog.se

Books Online for SQL Server 2005 athttp://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books...
Books Online for SQL Server 2000 athttp://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Hi Erland Sommarskog,
I see thanks very much for your interest
Omar Abid
www.omarabid.uni.cc

Aug 17 '07 #3

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

Similar topics

2
8305
by: plank | last post by:
Hey Peeps, Ok here is my situation.. I have a Java applet which allows the user to select files and upload them to the server. The applet converts the file to Base64 and then POSTS the data to an...
0
1294
by: mathieu cupryk | last post by:
in the Button1_Click I need to make the 1st column saved as readonly. How can I do this? using System; using System.Collections; using System.ComponentModel; using System.Data; using...
2
3170
by: Jay Walker | last post by:
I created a custom DataGridColumn based on Marcie Robillard's MSDN Article: Creating Custom Columns for the ASP.NET Datagrid...
0
1135
by: Luis Esteban Valencia | last post by:
in the Button1_Click I need to make the 1st column saved as readonly. How can I do this? using System; using System.Collections; using System.ComponentModel; using System.Data; using...
0
1119
by: DKode | last post by:
Hello, I am trying to call a UserControl after postback to save data filled out on that usercontrol to sql server. The problem I am having is this, I have 2 LinkButtons that I have setup as...
4
6702
by: Pedro Leite | last post by:
Good Afternoon. the code below is properly retreiving binary data from a database and saving it. but instead of saving at client machine is saving at the server machine. what is wrong with my...
3
1356
by: aaa | last post by:
How can I save data without connecting to data base every time a client's request arrives? If I work on a temporary memory I cannot work with sql queries, but connecting to data base takes time.
0
992
by: zoneal | last post by:
I am trying to learn asp.net and have run into a wall with a problem. Can anyone help me through this problem? I am using the SqlDataSource (set to an Access data base). I have a grid view...
4
1597
by: Annie | last post by:
Hi guys, I am having a weired situation that don't know how to handle it ... I have master pages, the master page contains a dynaic menu which is set up in the database and has page url, name,...
0
7129
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
7333
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
7502
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5637
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,...
1
5057
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4716
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3208
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1566
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
769
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.