c# - asp.net database data retained after table deleted -
i trying develop webpage based on data in database. able working code copied website. 1 line of data. when added several lines , tested again, still displayed 1 line. when deleted table , recreated another, same 1 line still being displayed, no matter seems. i've restarted pc , checked ms sql management studio , attached .mdf database looks ok. here's code:
protected void page_load(object sender, eventargs e) { sqlconnection scon = new sqlconnection("data source = .\\sqlexpress; attachdbfilename=f:\\workstation_main\\webprojects\\qura\\2015-06-11_asp\\qura_a08\\app_data\\populatedb.mdf; integrated security = true; initial catalog = populatetable; user instance=true; multipleactiveresultsets=true"); stringbuilder htmlstring = new stringbuilder(); if (!ispostback) { using (sqlcommand scmd = new sqlcommand()) { scmd.connection = scon; scmd.commandtype = commandtype.text; scmd.commandtext = "select * populatetable"; scon.open(); sqldatareader datareader = scmd.executereader(); if (datareader.hasrows) { while (datareader.read()) { htmlstring.append(datareader["datetime"]); htmlstring.append(datareader["statistics"]); } populateplaceholder.controls.add(new literal { text = htmlstring.tostring() }); datareader.close(); datareader.dispose(); } } } }
i appreciate if can tell me needs done. in advance.
i suspect database adding data not same database program reading from.
to test theory, delete rows in table , run web site see if still displays single row.
hope helps
Comments
Post a Comment