DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Fri, 10 Aug 2007 12:05:35 -0000,    posted on: microsoft.public.dotnet.framework        back       

Thread Index
  1    Omar Abid


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
Date:Fri, 10 Aug 2007 12:05:35 -0000   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us