CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Threaded View

  1. #1
    Join Date
    Jul 2002
    Posts
    788

    2 beginner questions

    hi,

    beginner questions..

    1)
    i am binding a datagrid view to a sql database. How can i make it such a way that if i change the data in the grid view, the same data will get updated into the database?

    2)if i want to update a particular field in my sql database, how to do it in csharp? i manage to write codes as below only, after much searching in the internet.

    Code:
        SqlConnection myConnection = new SqlConnection("Data Source=(local); Trusted_Connection=yes");
               SqlDataAdapter mySqlDataAdapter = new SqlDataAdapter("select * from Table1", myConnection);
    However,,,

    NOTE: When i add a datagridview and bind it to my database, visual studio (2008) automatically created the following for me.

    table1TableAdapter
    table1BindingSource
    testDataSet

    I have one table in my DB. I just lost on how to make use of this to update my DB. I believe it is possible for me to use the above objects to update individual field in my DB?
    Last edited by mce; March 18th, 2008 at 03:34 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
  •  





Click Here to Expand Forum to Full Width

Featured