Showing posts from October, 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" Upload excel file in DataTable

Image Upload excel file in DataTable and show in gridview control

aspx code

      <asp:Label ID="lblMsg" runat="server" Text="Upload excel file"></asp:Label>
<asp:GridView ID="GridView1" runat="server">
<div id="fileatt" runat="server" style="display: block" >
            <input type="file" name="attachment" runat="server" id="attachment"  />

      <asp:Button ID="btnUpload1" runat="server" Text="Upload" OnClick="btnUpload1_Click" Visible="true" />

VB CodeImports System.DataImports System.Data.OleDb.......... Protected Sub btnUpload1_Click(sender As Object, e As System.EventArgs) Handles btnUpload1.Click        Try            Dim uploadDir = "./upload/"            Dim temp = ""            Dim connectionString…

Google+ Followers