Total Pageviews

Wednesday, October 10, 2012

sqldatasource listview not updating,inserting mysql data


    listview not updating,inserting mysql data.

Data entered in textboxes is not getting updated in database. In debug mode I see that textbox1 and textbox2 in ItemUpdating event contain the same values as they had before calling ItemUpdating. therefore you are able to populate data in listview using select command but not able to update or insert.

Solution one : have a datakey value for listview property like  DataKeyNames="id"  where id is primary key


solution2 : check the connection string property it shoud be like this



add name="entertrackConnectionString" connectionString="server=191.254.1.xx;User Id=admin;password=xxxx;database=entertrack;Persist Security Info=True; SQLServerMode = true;Allow Zero Datetime=True;"
   providerName="MySql.Data.MySqlClient"

No comments: