Ahojte,
mam taku pre Vas asi velmi jednoduchu otazku. Mam viacero databaz ktore maju rovnaku strukturu ale obsahuju ine data. Vsetky tieto databazove instancie existuju na jednom zeleze. Chcel by som vediet ci je mozne v mysql nejakym sposobol zmenit jednym DML-kom vsetky vybrane instancie.
Za Vase odpovede vopred dakujem.
S.
Příspěvky odeslané z IP adresy 195.168.29.–
Ahoj.....
asp platforme sa velmi nevenujem ale dostal som za ulohu, upravit firemny script na export dat do excelu....Exportovanie funguje dobre az na jeden detail....pri exportovani dlhsich ciselnych hodnot mi do excelu ulozi odrezane cislo, a ja potrebujem nejak implicitne nastavit tieto riadky na format mso-number-format: 0, pri ktorom mi tieto hodnoty zobrazuje spravne...alebo aspon zeditovat data ktore exportujem....
prikladam script na export do xls, ak to s tohto useku nie je jasne napiste.....nieco poriesime naozaj surne potrebujem poradit.....na google som cosi ponachazal ale neviem sa pohnut.....
funkcie pre spracovanie:
/// <summary>
/// Save button handler.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public void Save_Click(Object sender, ImageClickEventArgs e)
{
int selectedType = (int)GetSelectedType() + 1;
string langID = data.LangNumber.ToString();
string statType = statTypes[selectedType];
DataView _fixDV = data.GetStatsListing(GetSelectedLogin(), GetSelectedYear(), GetSelectedMonth(), langID, statType);
_fixDV.Sort = this.FixDetailsSortBy;
Griddy.DataSource = _fixDV;
Griddy.DataBind();
Response.Clear();
Response.Buffer= true;
Response.ContentType = "application/vnd.ms-excel";
Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.AddHeader("content-disposition", "attachment;filename=export.xls");
this.EnableViewState = false;
System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
this.ClearControls(Griddy);
Griddy.RenderControl(oHtmlTextWriter);
Response.Write(oStringWriter.ToString());
Response.End();
}
/// <summary>zalozka
/// Funkcia pre spracovanie dat do formatu xls.
/// </summary>
/// <param name="ctrl"></param>
private void ClearControls(Control ctrl)
{
for (int i=ctrl.Controls.Count -1; i>=0; i--)
{
ClearControls(ctrl.Controls[i]);
}
if (!(ctrl is TableCell))
{
if (ctrl.GetType().GetProperty("SelectedItem") != null)
{
LiteralControl literal = new LiteralControl();
ctrl.Parent.Controls.Add(literal);
try
{
literal.Text = (string)ctrl.GetType().GetProperty("SelectedItem").GetValue(ctrl,null);
}
catch
{
}
ctrl.Parent.Controls.Remove(ctrl);
}
else
if (ctrl.GetType().GetProperty("Text") != null)
{
LiteralControl literal = new LiteralControl();
ctrl.Parent.Controls.Add(literal);
literal.Text = (string)ctrl.GetType().GetProperty("Text").GetValue(ctrl,null);
ctrl.Parent.Controls.Remove(ctrl);
}
}
return;
}
tu to volam:
<!-- Start export button-->
<asp:PlaceHolder ID="PanelSave" Runat="server" Visible="true">
<table border="0" width="100%">
<tr>
<td align="right">
<asp:ImageButton ID="btnSave" Text="Export" AutoPostBack="True" ImageUrl="../images/buttons/b_export.gif" OnClick="Save_Click" Runat="server" />
</td>
</tr>
</table>
</asp:PlaceHolder>
<!--End export button-->
</NControls:TabListItem>
</NControls:TabList>
<br>
<!-- Start DataGrid pre vypis exportovanych dat do xls.-->
<asp:DataGrid ID="Griddy" Runat="server" Visible="True"
Width="50%"
CellPadding="1"
CellSpacing="1"
BorderWidth="1"
CssClass="tableMain"
AutoGenerateColumns="True"
AllowSorting="True"
AllowPaging="True"
Style="mso-number-format: 0;">
<HeaderStyle CssClass="tableHeaderBold" ForeColor="Black" />
<ItemStyle CssClass="tableBody" />
<AlternatingItemStyle CssClass="tableBody" />
<PagerStyle Visible="False" CssClass="tablePager" Mode=NumericPages HorizontalAlign=Center />
</asp:DataGrid>
<!--End DataGrid-->
zatial dik..