|
thanks for the reply.
but i know how to insert,i asked insert query takes more time.
how to decrease the time? is it possible to insert with out looping?
dataadapter.update() or dataset.acceptchanges() helpts to insert or update to databse but my scenario my dataset has data from two database tables
[person,address]
is any other way to insert?Known is a drop , Unknown is an Ocean
|
|
|
|
|
your code will be like below.
string strQuery1="insert into tbl1(column) ";
string strQuery2="insert into tbl2(column2) ";
for (int i=1;ds.tables[0].rows.count;i++)
{
strQuery1 = strQuery1 + " SELECT " + ds.tables[0].Rows[0]["column1"].ToString() + " UNION ALL ";
strQuery2 = strQuery2 + " SELECT " + ds.tables[0].Rows[0]["column2"].ToString() + " UNION ALL ";
}
Now you get two queries in that two variables strQuery1, strQuery2, so you can execute with connection or command object.
actually you are executing multiple insert query in loop so it takes long time, but in this way you will get single query so it takes less time.
Then change the code depends on your no of columns which you want to store in db. also use stringbuilder instead of concatenating strings.
thatraja
|
|
|
|
|
You can create bulk insert using OpenXML as DataSet is actually an XML. Send XML to your stored proc which will insert them to the database.
See an excellent article regarding this :
Bulk Insert from DataSet to Database[^]
Use DataSet().GetXML() to get XML and pass it to the stored procedure
|
|
|
|
|
Have you looked at the SqlBulkCopy object?
|
|
|
|
|
better u can use bulkcopy
|
|
|
|
|
hi peoples,
one of our member has the same problem of mine in 2004,
i need to contact him what he did for that problem as the problem and requirement is so unique..
the problem is
I have few crystal reports in a project. I need to combine all the reports in one pdf. I can print each report in one pdf file but need to combine all of them in one. Any help would be highly appreciated
The member name is AliHaider,
his link of code project is
http://www.codeproject.com/Members/Visionsoft
can you please tell me how to contact him or if you know the answer please revert me
|
|
|
|
|
There are products available in market to combine multiple PDF files. U can use that.
1. print all u r reports as individual PDF file
2. using external products combine all this pdf to one pdf file
u need a lot of R&D work here( i think this would be an very interesting task to work on)
OR ELSE
Try something like this
1. Print all ur report to RTF file
2. Copy the content of each RTF file to stream and create a PDF file out of that.
|
|
|
|
|
hi guys i came with solution regarding...
get the PdfSharp.dll from website and then include in yours
the do the following..
it will work like gun...
using PdfSharp.Pdf;
using PdfSharp.Pdf.IO;
Stream[] ChildStream = new Stream[ReportDoc.Length];
Stream OutStream = new MemoryStream();
PdfDocument[] PdfChildDoc = new PdfDocument[ReportDoc.Length];
PdfDocument OutPutPage = new PdfDocument();
for (int i = 0; i < ReportDoc.Length; i++)
{
ChildStream[i] = (Stream)ReportDoc[i].ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
PdfChildDoc[i] = PdfReader.Open(ChildStream[i], PdfDocumentOpenMode.Import);
}
for (int i = 0; i < PdfChildDoc.Length; i++)
{
int count = PdfChildDoc[i].PageCount;
for (int idx = 0; idx < count; idx++)
{
// Get the page from the external document...
PdfPage page = PdfChildDoc[i].Pages[idx];
// ...and add it to the output document.
OutPutPage.AddPage(page);
}
}
OutPutPage.Save(OutStream, false);
//byte[] b = new byte[OutStream.Length];
//OutStream.Read(b, 0, b.Length);
Response.Buffer = true;
Response.ContentType = "application/pdf";
Response.BinaryWrite(((MemoryStream)OutStream).ToArray());
|
|
|
|
|
i have made a web application which run smoothly at local system but when i uploaded on web server and trying to login it gives runtime error
error is:
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customerrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customerrors> tag should then have its "mode" attribute set to "Off".
<configuration>
<system.web>
<customerrors mode="Off">
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customerrors> configuration tag to point to a custom error page URL.
<configuration>
<system.web>
<customerrors mode="RemoteOnly" defaultredirect="mycustompage.htm">
Thanks in advance
|
|
|
|
|
Then do as for as its Info, you can able to login. let me know if error comes after that
|
|
|
|
|
Hi!
I have been programming a web application with ASP.NET (.Net version 2) . when I run it on localhost, all things are correct. but when I upload files on my web server, many things are out of placed.
for example:
1. footer of my page: in localhost, it's on center of the page. in server, it's on right of the page.
2. Textbox sizes: in localhost, they are regular size. but in server, they are bigger and out of their regular place.
How can I do to correct this problem?
Regards.Mahdi Ghiasi
modified on Friday, February 12, 2010 2:04 AM
|
|
|
|
|
I guess you dont have proper css files published properly. Or the browser doesnt download them correctly.
Check the View-Source and see if the deployment and development sources are different.
There is no way that browser behaves differently when same code is executed. The problem must be in the html generated.
You can also look for other external files which are downloaded with the page is working correctly or not.
To simplify your task, Use Fiddeler[^]
|
|
|
|
|
Good One.
|
|
|
|
|
How I can download for example: from country it's cities, when I'll click co country page must redirect me corresponding cities...
C# Developer
|
|
|
|
|
Perhaps you'd like to take a few moments to compose your question better and edit it so it is understandable what you are asking for and what you would like. I know the language. I've read a book. - _Madmatt
|
|
|
|
|
well I'm using Entity Framework(I'm newbie in this)
I have Entities Country cities with onetomany realtionships
in domain are generated both of this classes, with it's properties...
but in cities There is only City.ID and for CountryID there is reference to Class country: public EntityReference<Country> CountryReference{//...}
and in Country Class:public EntityCollection<Cities> City{//...}
<asp:EntityDataSource ID="src" runat="server" ContextTypeName="Namespace.Domain" EntitySetName="Cities"
EntityTypeFilter="City" EnableInsert="true" EnableUpdate="true"EnableDelete="true">
<WhereParameters>
<asp:QueryStringParameter Name="here must be CountryID,but in class there is not such property" type="int32" DefaultValue="0" QueryStringField="CountryID">
</WhereParameters>
</asp:EntityDataSource>
sorry for my bad English
C# Developer
|
|
|
|
|
Hi gurus,
I have been looking around how to display stored images(varbinary(max)) from sql server2005 to Gridview. But I was unable to find a decent answer on google.
Do anyone of you have ever come across to this problem, if so, would you help me or perhaps suggest me to a resource.
Thanks
|
|
|
|
|
|
Thanks for replying. I am looking a solution for Asp.net. However, this is mentioned for client side applications.
I would like to know also which is a better way:
1. Display stored image as a blob format on gridview is faster or
2. Re-create blob image on the disk first and then point loction.
Thanks
|
|
|
|
|
|
I'm calling and aspx page with a color param. I need this color to be passed on the querystring, so I call the aspx as:
somepage.aspx?color=#FFFFFF&...
The color parameter in the querystring is set by ColorTranslator.ToHtml(Color)
I think here the problem is the # symbol. Is there a problem passing # as a parameter? How can i get back my Color object from this querystring ?
I tried :
if (!string.IsNullOrEmpty(Context.Request.QueryString["color"]))
Color = ColorTranslator.FromHtml(Context.Request.QueryString["color"]);
but for some reason the above if statement evaluates to false. How can I fix this ?
TIA
|
|
|
|
|
This seems to work:
protected void Page_Load(object sender, EventArgs e)
{
String Color;
if (Request.QueryString["color"] != null)
{
Color = Request.QueryString["color"];
}
}
protected void Button1_Click1(object sender, EventArgs e)
{
String URL = "Default.aspx?color=" + Server.UrlEncode("#FFFFFF");
Response.Redirect(URL);
}
Steve Wellens
|
|
|
|
|
You mean
paper67 wrote: if (!string.IsNullOrEmpty(Context.Request.QueryString["color"]))
Evaluates to false ?
Did you put the QueryString correctly.
Use HttpUtility.UrlEncode before sending the color code. And after fetching use HttpUtility.UrlDecode to get the color code back properly.
|
|
|
|
|
From the asp.net page, I would like to view the reporting services reports i.e. the .rdl files.
I am using a reportviewer to access one of the reports as follows. Notice that I have hardcoded the name of the .rdl report.
Question:
There are several reports. The names are stored in a table in the database. Do you know how I can populate a listbox with the names of the reports but do not know how to show the selected report in the viewer. Notice that at present I am hardcoding just one name and not sure how to be able to show the selected report
<rsweb:ReportViewer ID="ReportViewer1" runat="server" ProcessingMode="Remote"
Font-Names="Verdana" Font-Size="8pt" Height="1000px" Width="1000px" >
<ServerReport ReportServerUrl="http://reportserver/reportserver"
ReportPath="/reportfiles/myReport" />
</rsweb:ReportViewer>
Any thoughts please?
thanks
|
|
|
|
|
You can try below code because what i did in the code is added reportviewer control dynamically to div control on page
and its working file for me
protected void bRunReport_Click1(object sender, EventArgs e)
{
if (Page.IsValid)
{
divRptView.Controls.Clear();
#region reportviewer setting
ReportViewer ReportViewer1 = new ReportViewer();
ReportViewer1.ProcessingMode = ProcessingMode.Local;
ReportViewer1.ID = "ReportViewer1";
ReportViewer1.Font.Bold = false;
ReportViewer1.Font.Name = "Arial";
ReportViewer1.ShowExportControls = false;
ReportViewer1.ShowBackButton = false;
ReportViewer1.SizeToReportContent = true;
ReportViewer1.BackColor = System.Drawing.Color.WhiteSmoke;
ReportViewer1.LocalReport.DataSources.Clear();
#endregion reportviewer setting
string _reportID = string.Empty;
bool isnull = true;
#region snapshot
else if (ddlListofReports.SelectedValue == "1")
{
_reportID = "snapshot";
List<snapshot> slist = new snapshot().GetCustomersForCountry(this.ddljobsSnapshot.SelectedValue);
ReportViewer1.LocalReport.ReportPath = "Admin\\ReportDesigns\\" + _reportID + ".rdlc";
if (slist != null)
{
if (slist.Count > 0)
{
ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("snapshot1", slist));
isnull = false;
}
}
}
#endregion snapshot
#region VoiceAgentUtilization
else if (ddlListofReports.SelectedValue == "2")
{
DateTime _dcstarttime = Convert.ToDateTime(this.txtAgetnFromDate.Text);
string _dcstarttimestr = _dcstarttime.ToLongDateString() + " " + _dcstarttime.ToLongTimeString();
DateTime _dctotime = Convert.ToDateTime(this.txtAgentTodate.Text);
_reportID = "VoiceAgentUtilization";
List<AgentDetailed> alist = new AgentDetailed().getAgentReport(this.dcagent.SelectedItem.ToString(), _dcstarttime, _dctotime);
ReportViewer1.LocalReport.ReportPath = "Admin\\ReportDesigns\\" + _reportID + ".rdlc";
if (alist != null)
{
if (alist.Count > 0)
{
ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("AgentDetailed1", alist));
isnull = false;
ReportParameter starttime = new ReportParameter("StartTime", _dcstarttimestr);
ReportParameter endtime = new ReportParameter("EndTime", _dctotime.ToString());
ReportParameter Agent = new ReportParameter("Agent", this.dcagent.SelectedItem.ToString());
ReportParameter[] p = { starttime, endtime, Agent };
ReportViewer1.LocalReport.EnableExternalImages = true;
ReportViewer1.LocalReport.SetParameters(p);
}
}
}
#endregion VoiceAgentUtilization
if (!isnull)
{
lblMessageBox.Visible = false;
if (ddlListofReports.SelectedValue != "11")
{
divRptView.Controls.Add(ReportViewer1);
ReportViewer1.Height = 290 + (25 * 10);
ReportViewer1.Width = Unit.Percentage(91);
ReportViewer1.ShowRefreshButton = false;
ReportViewer1.Visible = true;
ReportViewer1.ShowPrintButton = true;
ReportViewer1.SizeToReportContent = true;
ReportViewer1.LocalReport.Refresh();
}
}
else
{
lblMessageBox.Visible = true;
lblMessageBox.Text = "No Records are avaliable.";
ReportViewer1.Visible = false;
}
}
}
|
|
|
|