Results 1 to 3 of 3

Thread: Save

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2002
    Location
    Pilipinas
    Posts
    441

    Save

    I have tried this code to save records in C#.NET.

    //Save
    DataRow row = dataSet11.Student.NewStudentRow;
    row.ItemArray(0) = textBox1.Text;
    row.ItemArray(1) = textBox2.Text;
    row.ItemArray(2) = textBox3.Text;
    row.ItemArray(3) = textBox4.Text;
    dataSet11.Student.AddStudentRow;
    dataSet11.AcceptChanges;

    But it doesn't work.
    Any solution to this problem?

  2. #2
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    Try using the 'Update' method of the dataAdapter object. 'AcceptChanges' tells the dataSet to reset its dirty flags.

  3. #3
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Do you come from VB?

    You need function parentheses even for argument-less functions:
    dataSet11.AcceptChanges();

    Also array indexing is done using brackets:
    row.ItemArray[0]

    or ItemArray might even be the indexer (look it up in the reference):
    row[0]
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

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