bindingSource1.EndEdit() not saving to sql db
I've followed this example on C# Corner, my connection points to an existing sql db on server and bound my textboxes to the bindingsource. I can click next and previous ok and see the existing data, however I can't save any changes. My save button calls
bindingSource1.EndEdit();
if I restart the application it still has the old data and not save the change. Why might this be please, I've spent several hours searching and experimenting to no avail.
Edit:
I've now added events for bindingSource1 Current Changed & Binding complete, these events are happening as I next and prev and save, so binding is working and it knows that current has changed, but will not save.
c# sql
add a comment |
I've followed this example on C# Corner, my connection points to an existing sql db on server and bound my textboxes to the bindingsource. I can click next and previous ok and see the existing data, however I can't save any changes. My save button calls
bindingSource1.EndEdit();
if I restart the application it still has the old data and not save the change. Why might this be please, I've spent several hours searching and experimenting to no avail.
Edit:
I've now added events for bindingSource1 Current Changed & Binding complete, these events are happening as I next and prev and save, so binding is working and it knows that current has changed, but will not save.
c# sql
after changing value in textbox please focus cursor on something else, and try to click the save button.
– ikram
Nov 21 '18 at 12:47
@ikram thanks, I clicked in the other text box and it did the same ;-(
– chasher
Nov 21 '18 at 12:55
add a comment |
I've followed this example on C# Corner, my connection points to an existing sql db on server and bound my textboxes to the bindingsource. I can click next and previous ok and see the existing data, however I can't save any changes. My save button calls
bindingSource1.EndEdit();
if I restart the application it still has the old data and not save the change. Why might this be please, I've spent several hours searching and experimenting to no avail.
Edit:
I've now added events for bindingSource1 Current Changed & Binding complete, these events are happening as I next and prev and save, so binding is working and it knows that current has changed, but will not save.
c# sql
I've followed this example on C# Corner, my connection points to an existing sql db on server and bound my textboxes to the bindingsource. I can click next and previous ok and see the existing data, however I can't save any changes. My save button calls
bindingSource1.EndEdit();
if I restart the application it still has the old data and not save the change. Why might this be please, I've spent several hours searching and experimenting to no avail.
Edit:
I've now added events for bindingSource1 Current Changed & Binding complete, these events are happening as I next and prev and save, so binding is working and it knows that current has changed, but will not save.
c# sql
c# sql
edited Nov 21 '18 at 13:06
asked Nov 21 '18 at 12:24
chasher
196
196
after changing value in textbox please focus cursor on something else, and try to click the save button.
– ikram
Nov 21 '18 at 12:47
@ikram thanks, I clicked in the other text box and it did the same ;-(
– chasher
Nov 21 '18 at 12:55
add a comment |
after changing value in textbox please focus cursor on something else, and try to click the save button.
– ikram
Nov 21 '18 at 12:47
@ikram thanks, I clicked in the other text box and it did the same ;-(
– chasher
Nov 21 '18 at 12:55
after changing value in textbox please focus cursor on something else, and try to click the save button.
– ikram
Nov 21 '18 at 12:47
after changing value in textbox please focus cursor on something else, and try to click the save button.
– ikram
Nov 21 '18 at 12:47
@ikram thanks, I clicked in the other text box and it did the same ;-(
– chasher
Nov 21 '18 at 12:55
@ikram thanks, I clicked in the other text box and it did the same ;-(
– chasher
Nov 21 '18 at 12:55
add a comment |
1 Answer
1
active
oldest
votes
Fixed:
Adding this line after EndEdit()
YourTableAdapter.Update(YourDataSet.YourDB);
solves the problem, which is updating the dataset.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53411971%2fbindingsource1-endedit-not-saving-to-sql-db%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Fixed:
Adding this line after EndEdit()
YourTableAdapter.Update(YourDataSet.YourDB);
solves the problem, which is updating the dataset.
add a comment |
Fixed:
Adding this line after EndEdit()
YourTableAdapter.Update(YourDataSet.YourDB);
solves the problem, which is updating the dataset.
add a comment |
Fixed:
Adding this line after EndEdit()
YourTableAdapter.Update(YourDataSet.YourDB);
solves the problem, which is updating the dataset.
Fixed:
Adding this line after EndEdit()
YourTableAdapter.Update(YourDataSet.YourDB);
solves the problem, which is updating the dataset.
answered Nov 21 '18 at 13:26
chasher
196
196
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53411971%2fbindingsource1-endedit-not-saving-to-sql-db%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
after changing value in textbox please focus cursor on something else, and try to click the save button.
– ikram
Nov 21 '18 at 12:47
@ikram thanks, I clicked in the other text box and it did the same ;-(
– chasher
Nov 21 '18 at 12:55