Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / June 2006

Tip: Looking for answers? Try searching our database.

Cannot Update data via DatagridView

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mk - 20 Jun 2006 15:38 GMT
Hi all,
I am using VS2005. I am using Datagrid view to edit some datas and
update it.
this is what I have bind to Datagridview

SqlAdapter = New SqlDataAdapter()
           SqlAdapter.SelectCommand = SqlCmd

           Dim Cmd As New SqlCommand("Update Table_xxx Set Remarks=@q1
Where SiNo=@q2", con)
           Dim Objparam As SqlParameter
           Objparam = Cmd.Parameters.Add("@q1", SqlDbType.VarChar)
           Objparam.Direction = ParameterDirection.Input
           Objparam.SourceColumn = "Remarks"
           Objparam.SourceVersion = DataRowVersion.Current

           Objparam = Cmd.Parameters.Add("@q2", SqlDbType.Int)
           Objparam.Direction = ParameterDirection.Input
           Objparam.SourceColumn = "SiNo"
           Objparam.SourceVersion = DataRowVersion.Original

           SqlAdapter.UpdateCommand = Cmd
           DBGrid1.DataSource = Nothing
           DBGrid1.Columns.Clear()
           DGridDS.Clear()
           SqlAdapter.Fill(DGridDS)
           DBGrid1.DataSource = DGridDS.Tables(0)

And my Values updating Process goes here..

  If DGridDS.HasChanges Then
           Dim TDS As New DataSet
           TDS = DGridDS.GetChanges(DataRowState.Modified)
           SqlAdapter.Update(TDS)
 End If

Everythings goes fine.. but when I try to update the column value.. its
is not updating. when i debug the code i found that the
DGridDS.HasChanges returns false.
but when i try update the columns continually the second,third  and so
on.. is updating well
The Problem is when updating the column at first..
I don't know where I am missing the code.
Please help me..
Regards
Muthu Kumaran.D
mk - 22 Jun 2006 05:12 GMT
Is no one there? Please tell me what to do..
Regards,
Muthu Kumaran.D

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.