locked
Data not stored in table RRS feed

  • Question

  • User-1126311051 posted

    Hi,

    My web page form tells me that new records are successfully created in database but when I check the table data, the records were not stored in the database table. It was perfectly doing until I deleted some columns of the database table and added one column. I use profile provider to create user records. I do not get any error except that I do not know where the newly created records go. I still can see the old records in the table. 

    I appreciate if you give me any possible solution.

    Thanks

    Friday, September 2, 2016 9:57 PM

Answers

  • User-1126311051 posted

    Dear Partrice,

    I really appreciate your effort to assist.

    Finally, I figured out the cause of the problem but where the records went is still mystery. The cause of the wrong behavior was a  profile property for Date included in config file along with the other field names. As I added a new column for Date in the database table,  I added <add name="Date" type="DateTime"/> in config file for profile property the same way i did for other fields. When I deleted it (only the  Date part) from the config file, normal behavior came back and i see new records in the table. When I added it back, the behavior came again. I am fine without it. 

    Thank you again. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, September 3, 2016 10:38 PM

All replies

  • User753101303 posted

    Hi,

    As often you need first to fully understand what happens before fixing it:
    - are you 100% sure you are not hiding possible exceptions?
    - could it be that something is misconfigured and that it doesn't go to the right database (in particular if using AttachDbFile)
    - similary it can happen that the db is correctly written but that the data file is later overwritten

    Double check the web.config file. If still unclear my first move would be likely to use the SQL Server Profiler to check if the expected SQL statements is actually sent to the expected SQL Server engine. If your code does include if statements make sure also you run the excepted branch (using the VS debugger).

    Friday, September 2, 2016 11:05 PM
  • User-1126311051 posted

    Thank you for your response. No error response at all. Connection string and table name is correct. I can see old data from the table. The database is on production server. It was working fine till this morning. 

    Where and how can the newly created records go out of the right table?

    Friday, September 2, 2016 11:17 PM
  • User753101303 posted

    This is why I would use the SQL Server profiler as suggested earlier. It would allow to check if a SQL statement is really sent to this database. You can see https://msdn.microsoft.com/en-us/library/ms181091.aspx for details.

    You are really sure that you don't have for example an empty catch clause that could hide an exception?

    Or could it be that the updating code is not called at all?

    To debug a bad behavior, you have to question your code and narrow down progressively the issue. I would start by making 100% sure if a SQL statement is sent to the db using the SQL Server Profiler, then to make sure the code that does this update is really called (ie the SQL statement is supposed to be really sent) and at this point it would left us with :
    - an error that is hidden
    - or the statement is sent to a wrong destination

    Saturday, September 3, 2016 6:48 PM
  • User-1126311051 posted

    Dear Partrice,

    I really appreciate your effort to assist.

    Finally, I figured out the cause of the problem but where the records went is still mystery. The cause of the wrong behavior was a  profile property for Date included in config file along with the other field names. As I added a new column for Date in the database table,  I added <add name="Date" type="DateTime"/> in config file for profile property the same way i did for other fields. When I deleted it (only the  Date part) from the config file, normal behavior came back and i see new records in the table. When I added it back, the behavior came again. I am fine without it. 

    Thank you again. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, September 3, 2016 10:38 PM
  • User753101303 posted

    My guess would be that it causes an exception (maybe because Date is a reserved keyword not properly escaped at the provider level?) and that for some reason this exception is hidden.

    Sunday, September 4, 2016 12:11 PM