how to update database directly with datagridview


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 8 of 8

Thread: how to update database directly with datagridview

  1. #1
    Join Date
    Mar 2008
    Posts
    3

    how to update database directly with datagridview

    Hello
    I am having with datagridview. Actually i would like to explain in detail
    In Form1 i am having Datagridview with columns Bill_No, Product_Description, Quantity, Rate, Amount(5 Columns) I am not binding with database to populate the datagridview.

    My problem is that when the user insert into datagridview and When the form is closed before that my database should be updated with the each every cell so entered in their respective column in database.

    Secondly ,I am having three textbox costtxt, profittxt, sptxt
    For example when in costtxt the value is 2000 and in profittxt its 20% then in textbox sptxt it must display the value of 2400 i.e [2000+400(20% of 2000)]

    Can anybody solve my problem?

  2. #2
    Join Date
    Mar 2008
    Posts
    7
    What kind of database are you using?

  3. #3
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    In all situations like this I always recommend updateing the underlaying data source, i.e., the database, and refreshing the display rather than attempting the reverse.
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  4. #4
    Join Date
    Mar 2008
    Posts
    3
    i am using sql server 2005

  5. #5
    Join Date
    Mar 2008
    Posts
    7
    Just like hack said you need some sort of update function which commits the data to the database. Im not sure what it is with sql server as im not too familiar with it, but with 'microsoft jet ole' you just update the 'oleadapter' to which the data grid is connected to.

  6. #6
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    Regardless of the database, you can execute an SQL UPDATE query that will modify any existing record in your DB.
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  7. #7
    Join Date
    Mar 2008
    Posts
    3
    Ok fine i think it will work but what about the second problem. In a form i have three text box and how to get the value of thrid textbox.

  8. #8
    Join Date
    May 2004
    Location
    Duluth MN
    Posts
    353
    Quote Originally Posted by heena patel
    Ok fine i think it will work but what about the second problem. In a form i have three text box and how to get the value of thrid textbox.
    Your best bet is to add a button to perform the calculation. You can try to use events in the 2 textboxs to monitor changes, but this becomes problematic. If you want it to appear seamless without user action, a timer would be another approach.

    ...joe

Similar Threads

  1. Offline database update * Advice *
    By Drew_gable in forum Database
    Replies: 2
    Last Post: 05-26-2006, 05:29 PM
  2. sql database update
    By ksuwanto8ksd in forum VB Classic
    Replies: 1
    Last Post: 06-14-2005, 03:42 PM
  3. How to update SQL Database from Flex Grid
    By ryanlcs in forum VB Classic
    Replies: 1
    Last Post: 06-13-2005, 12:42 PM
  4. ASP.NET - Update database with databinding
    By MichaelChoi in forum ASP.NET
    Replies: 2
    Last Post: 01-15-2003, 08:37 PM
  5. How to update the database?
    By Steven in forum Database
    Replies: 1
    Last Post: 01-08-2001, 08:46 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center