| |

VerySource

 Forgot password?
 Register
Search
View: 852|Reply: 6

tableadapter.update (ds.table) fails, why

[Copy link]

3

Threads

15

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

Post time: 2020-1-24 12:40:01
| Show all posts |Read mode
Looking through the breakpoint, it was found that ds.table.rows.add (row) was successful, and the data was added to ds.table. Then, after tableadapter.update (ds.table), check the properties of the tableadapter. The adapter's insertcommand is : INSERT INTO `JYDJL` (` time`, `type`,` kind`, `game`,` community service`, `account`,` password`, `PIN`,` character name`, `method`,` ` Communication software`, `Communication software ID`,` Phone`, `Details`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,? ).

Later check, the data of each field in the parameters in the insertcommand in the adapter of the adaptable adapter was obtained. After the added action was completed, the data was added to the DATAGERIDVIEW bound to DATASET.TABLE, but later found that the The authenticity is written into the database, why is it so?
Reply

Use magic Report

0

Threads

14

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-2-10 21:30:01
| Show all posts
No error prompt? Did you catch it?
Reply

Use magic Report

3

Threads

15

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

 Author| Post time: 2020-2-11 12:45:01
| Show all posts
try
                    {
                        jYDJLTableAdapter.Update (managerDataSet.JYDJL);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show ("Add failed! Reason for failure:" + ex.Message, "Hint", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }

No errors are suggested
Reply

Use magic Report

3

Threads

15

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

 Author| Post time: 2020-2-11 18:00:02
| Show all posts
I also tried the method of using tableadapter.insert, but I still can't load the data into the database and can only update it in DATASET.
Reply

Use magic Report

3

Threads

15

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

 Author| Post time: 2020-3-1 13:00:02
| Show all posts
Which one would help me a lot ~ How to update the database in the dataset
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-25 14:30:02
| Show all posts
I also encountered this problem. . . . Urgent
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-25 14:45:01
| Show all posts
If the primary key or unique column is included, if the table does not contain a relationship, then use the automatic generation command, and only need Adapter.Update() when saving.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list