Why i can not add data into new added column










0















I am amateur C# developer.Now i'm working on destkop application and work with MS2015 and SQL Management Studio.I have added new column into my database and write what is needed for it in .cs code,but can not add my data into column.It always shows NULL even if it is not empty.Here is my code about saving data:



 private void btnSave_Click(object sender, EventArgs e) txtQuantity.Text == "" 









share|improve this question
























  • Amount is my new column

    – Nicat101
    Nov 13 '18 at 19:57











  • I think before updating the state of model, you need to attach it. Like - db.Tables.Attach(model); and then you modify the state and save.

    – Piyush Khanna
    Nov 13 '18 at 20:10












  • Sir,i have done it but it did not solve the problem

    – Nicat101
    Nov 14 '18 at 8:32















0















I am amateur C# developer.Now i'm working on destkop application and work with MS2015 and SQL Management Studio.I have added new column into my database and write what is needed for it in .cs code,but can not add my data into column.It always shows NULL even if it is not empty.Here is my code about saving data:



 private void btnSave_Click(object sender, EventArgs e) txtQuantity.Text == "" 









share|improve this question
























  • Amount is my new column

    – Nicat101
    Nov 13 '18 at 19:57











  • I think before updating the state of model, you need to attach it. Like - db.Tables.Attach(model); and then you modify the state and save.

    – Piyush Khanna
    Nov 13 '18 at 20:10












  • Sir,i have done it but it did not solve the problem

    – Nicat101
    Nov 14 '18 at 8:32













0












0








0








I am amateur C# developer.Now i'm working on destkop application and work with MS2015 and SQL Management Studio.I have added new column into my database and write what is needed for it in .cs code,but can not add my data into column.It always shows NULL even if it is not empty.Here is my code about saving data:



 private void btnSave_Click(object sender, EventArgs e) txtQuantity.Text == "" 









share|improve this question
















I am amateur C# developer.Now i'm working on destkop application and work with MS2015 and SQL Management Studio.I have added new column into my database and write what is needed for it in .cs code,but can not add my data into column.It always shows NULL even if it is not empty.Here is my code about saving data:



 private void btnSave_Click(object sender, EventArgs e) txtQuantity.Text == "" 






c# sql-server






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 13 '18 at 20:00









jdweng

17.4k2717




17.4k2717










asked Nov 13 '18 at 19:54









Nicat101Nicat101

12




12












  • Amount is my new column

    – Nicat101
    Nov 13 '18 at 19:57











  • I think before updating the state of model, you need to attach it. Like - db.Tables.Attach(model); and then you modify the state and save.

    – Piyush Khanna
    Nov 13 '18 at 20:10












  • Sir,i have done it but it did not solve the problem

    – Nicat101
    Nov 14 '18 at 8:32

















  • Amount is my new column

    – Nicat101
    Nov 13 '18 at 19:57











  • I think before updating the state of model, you need to attach it. Like - db.Tables.Attach(model); and then you modify the state and save.

    – Piyush Khanna
    Nov 13 '18 at 20:10












  • Sir,i have done it but it did not solve the problem

    – Nicat101
    Nov 14 '18 at 8:32
















Amount is my new column

– Nicat101
Nov 13 '18 at 19:57





Amount is my new column

– Nicat101
Nov 13 '18 at 19:57













I think before updating the state of model, you need to attach it. Like - db.Tables.Attach(model); and then you modify the state and save.

– Piyush Khanna
Nov 13 '18 at 20:10






I think before updating the state of model, you need to attach it. Like - db.Tables.Attach(model); and then you modify the state and save.

– Piyush Khanna
Nov 13 '18 at 20:10














Sir,i have done it but it did not solve the problem

– Nicat101
Nov 14 '18 at 8:32





Sir,i have done it but it did not solve the problem

– Nicat101
Nov 14 '18 at 8:32












1 Answer
1






active

oldest

votes


















0














If you add an exception handler, it will tell you what's wrong.



Wrap your code in a try/catch block.



try

// your code goes here


catch(Exception ex)

Debug.Writeln(ex.Message);






share|improve this answer























  • Terry Carmen,sir i used try/catch block but it showed no problem

    – Nicat101
    Nov 14 '18 at 7:44










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
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53288544%2fwhy-i-can-not-add-data-into-new-added-column%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









0














If you add an exception handler, it will tell you what's wrong.



Wrap your code in a try/catch block.



try

// your code goes here


catch(Exception ex)

Debug.Writeln(ex.Message);






share|improve this answer























  • Terry Carmen,sir i used try/catch block but it showed no problem

    – Nicat101
    Nov 14 '18 at 7:44















0














If you add an exception handler, it will tell you what's wrong.



Wrap your code in a try/catch block.



try

// your code goes here


catch(Exception ex)

Debug.Writeln(ex.Message);






share|improve this answer























  • Terry Carmen,sir i used try/catch block but it showed no problem

    – Nicat101
    Nov 14 '18 at 7:44













0












0








0







If you add an exception handler, it will tell you what's wrong.



Wrap your code in a try/catch block.



try

// your code goes here


catch(Exception ex)

Debug.Writeln(ex.Message);






share|improve this answer













If you add an exception handler, it will tell you what's wrong.



Wrap your code in a try/catch block.



try

// your code goes here


catch(Exception ex)

Debug.Writeln(ex.Message);







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 13 '18 at 20:42









Terry CarmenTerry Carmen

2,5591818




2,5591818












  • Terry Carmen,sir i used try/catch block but it showed no problem

    – Nicat101
    Nov 14 '18 at 7:44

















  • Terry Carmen,sir i used try/catch block but it showed no problem

    – Nicat101
    Nov 14 '18 at 7:44
















Terry Carmen,sir i used try/catch block but it showed no problem

– Nicat101
Nov 14 '18 at 7:44





Terry Carmen,sir i used try/catch block but it showed no problem

– Nicat101
Nov 14 '18 at 7:44



















draft saved

draft discarded
















































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.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53288544%2fwhy-i-can-not-add-data-into-new-added-column%23new-answer', 'question_page');

);

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







Popular posts from this blog

Use pre created SQLite database for Android project in kotlin

Darth Vader #20

Ondo