|
I was thinking of using select method. Is there any example for selecting data from two different datatables?
Rock Star
|
|
|
|
|
If you are using dotNetFramework 3.5 using Linq would be the easiest way
|
|
|
|
|
Use the SQL sentence:
SELECT A.PID,B.FID FROM A,B WHERE A.CID=B.CID,
write it in Visual Studio or Procedure
April
Comm100 - Leading Live Chat Software Provider
modified 27-May-14 8:53am.
|
|
|
|
|
???Do you want to get a datatable??
StringBuilder strSQL= new StringBuilder("select A.* from A a inner join B on A.CID = B.CID");
SqlCommand cmd = new SqlCommand(strSQL.ToString(), conn, transaction);
DataTable C= new DataTable();
C.Load(cmd.ExecuteReader(), LoadOption.Upsert);
April
Comm100 - Leading Live Chat Software Provider
modified 27-May-14 8:53am.
|
|
|
|
|
hi sir,
please help me.i am new in asp.net.
sir when i am using my web application on web it goes to log out suddenly.while it is working fine locally.
please suggest me what can be the issue.
and one more question sir my web application is very slow on web.but it working fast locally.
|
|
|
|
|
vikas shukla wrote: log out suddenly
Things don't happen suddenly and mysteriously, there is a cause of the action. Without knowing anything about your project, how it is coded, what you are doing, it is impossible to give any specific advice.
The speed difference can be attributed to the speed of your internet connection, the amount of data that is being transmitted, load on the server, and potentially several other factors
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hi , I am using the following code to show the video stream in an image tag in aspx page.
It is working well in the firefox by showing the updated image from camera but it is not working
for Interner Explorer the image is not refreshed in the Internet Explorer what is the problem and how can it be resolved .The url for the image remains the same.
The code is :-
<title>
<asp:scriptmanager runat="server" enablepartialrendering="true" asyncpostbacktimeout="180">
<asp:timer id="timer" runat="server" interval="2" ontick="timer_Tick">
<asp:updatepanel id="upImage" runat="server" updatemode="Always">
<triggers>
<asp:asyncpostbacktrigger controlid="timer" eventname="Tick">
<contenttemplate>
<asp:image id="animatedImage" imageurl="http://IP Address of Camera/img/video.mjpeg" runat="server">
<asp:label id="test" runat="server">
|
|
|
|
|
Hi,
Am converting dataset to excel on button_Click using the below described code,
string attachment = "attachment; filename=Employee.xls";
Response.ClearContent();
Response.AddHeader("content-disposition", attachment);
Response.ContentType = "application/ms-excel";
StringWriter stw = new StringWriter();
HtmlTextWriter htextw = new HtmlTextWriter(stw);
gvEmployee.RenderControl(htextw);
Response.Write(stw.ToString());
Response.End();
, after excel gets downloaded none of the other events get activated unless the page is refreshed.
How to download the excel in the same page retaining the controls in that page.
beula.
|
|
|
|
|
Hi,
with GemBox.Spreadsheet Excel C# library you can easily convert DataSet to Excel and stream it to browser.
Here is a code snippet how to do it:
var ef = new ExcelFile();
foreach (var dataTable in dataSet.Tables)
{
var ws = ef.Worksheets.Add(dataTable.TableName);
ws.InsertDataTable(dataTable, "A1", true);
}
Response.Clear();
Response.ContentType = "application/vnd.ms-excel";
Response.AddHeader("Content-Disposition", "attachment; filename=Employee.xls");
ef.SaveXls(Response.OutputStream);
Response.End();
|
|
|
|
|
Wich dataaccess metod is faster - with datareader when the data is return from stored procedures or with LINQ.
What is the difference if is working with milions of records in a table?
Thanks for your answers!
|
|
|
|
|
|
A properly used data reader will always be faster ... since it is of course the most direct method of accessing data in .NET. Data readers are even more efficient if you define indexes for the returned columns instead of using the string look-up method.
|
|
|
|
|
Do you how much faster it will be? Do you have any statistics for example table with 10 milin rows?
|
|
|
|
|
I have a system which I currently maintain that I converted one report from LINQ to the Data reader method. The one report was estimated to have a run time of a week with LINQ (we never let it finish just did timings on subsets) and the data reader version takes 30 seconds. Admittedly the LINQ version could have been cleaned up but LINQ encourages bad code so that needs to be watched for as well. In general
Data Readers with integer column indexes on well written stored procedures: fastest
Data Readers with string column indexes on well written stored procedures: 10x slower
LINQ 20x to 100x slower. Some situations LINQ will be just as fast as data readers but never faster.
You can ignore the size of the database for the discussion. If you want statistics there is someone who did a nice little timing comparison between all of the methods (you can search Google if you want) or you can take my word for it.
|
|
|
|
|
Ennis Ray Lynch, Jr. wrote: The one report was estimated to have a run time of a week with LINQ
That is possibly a little unfair, I've had 1st draft stored procs that have run times of hours, after a little works and some indexing they get reduced to seconds.
However your point that LINQ encourages lousy code by abstracting another layer is the telling point. How many devs get under the hood of the Linq, or are even capable of doing so!
I'm of the opinion that LINQ is one of the greatest abominations ever to come out of MS.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Look here[^]
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hi,
I want to have a set of "export" buttons which generates a different type of report when the user clicks any of these, and then prompts the user to download the generated report (let's say that this report is an xls file).
What should I do so that when the user clicks the button, it will not post-back the page and still prompt the user to download?
Is there any control that I can use?
Thanks.
Rafferty
|
|
|
|
|
Global.ASAX
<%@ Application Codebehind="Global.asax.vb" Inherits="AdamItiel.GlobalApp" Language="vb" %>
Global.ASAX.VB
<br />
Imports System.Web.SessionState<br />
<br />
Namespace AdamItiel<br />
Public Class GlobalApp<br />
Inherits System.Web.HttpApplication<br />
<br />
Private Shared userFirstNameVal As String<br />
Public Shared Property UserFirstName() As String<br />
Get<br />
Return userFirstNameVal<br />
End Get<br />
Set(ByVal value As String)<br />
userFirstNameVal = value<br />
End Set<br />
End Property<br />
<br />
Private Shared newPropertyValue As String<br />
Public Shared Property UserLastname() As String<br />
Get<br />
Return newPropertyValue<br />
End Get<br />
Set(ByVal value As String)<br />
newPropertyValue = value<br />
End Set<br />
End Property<br />
<br />
<br />
Private Shared newPropertyValue2 As String<br />
Public Shared Property ClientTypeDesc() As String<br />
Get<br />
Return newPropertyValue2<br />
End Get<br />
Set(ByVal value As String)<br />
newPropertyValue2 = value<br />
End Set<br />
End Property<br />
<br />
Private Shared newPropertyValue3 As String<br />
Public Shared Property Coach() As String<br />
Get<br />
Return newPropertyValue3<br />
End Get<br />
Set(ByVal value As String)<br />
newPropertyValue3 = value<br />
End Set<br />
End Property<br />
<br />
<br />
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)<br />
' Fires when the application is started<br />
End Sub<br />
<br />
Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)<br />
' Fires when the session is started<br />
End Sub<br />
<br />
Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)<br />
' Fires at the beginning of each request<br />
End Sub<br />
<br />
Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs)<br />
' Fires upon attempting to authenticate the use<br />
End Sub<br />
<br />
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)<br />
' Fires when an error occurs<br />
End Sub<br />
<br />
Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)<br />
' Fires when the session ends<br />
End Sub<br />
<br />
Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)<br />
' Fires when the application ends<br />
End Sub<br />
<br />
End Class<br />
End Namespace<br />
<br />
<br />
Default.aspx
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="AdamItiel._Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
QQQQQQQQQQQQQQQQQ
</div>
</form>
</body>
</html>
Default.aspx.VB
Namespace AdamItiel<br />
<br />
Public Partial Class _Default<br />
Inherits System.Web.UI.Page<br />
<br />
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load<br />
<br />
End Sub<br />
<br />
End Class<br />
<br />
End Namespace<br />
<br />
Why do I get "Could not load type 'AdamItiel.GlobalApp'"?
|
|
|
|
|
Hi all,
In my website I have made program that if any error will come then an email comes to me.
I want to also know IP address,browsertype etc.. of that machine in the email.
Thanks to all..
|
|
|
|
|
code is below
Request.ServerVariables["REMOTE_ADDR"]
|
|
|
|
|
Thanks Dear,
But how can we get browser informatio ?
|
|
|
|
|
Look at this [^]one.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
you can get the information by Request.Browser.*.
For example
Request.Browser.Browser
you can get the user browser
|
|
|
|
|
private string GetClientIP()
{
string result = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
if (null == result || result == String.Empty)
{
result = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
}
if (null == result || result == String.Empty)
{
result = HttpContext.Current.Request.UserHostAddress;
}
return result;
}
April
Comm100 - Leading Live Chat Software Provider
modified 27-May-14 8:54am.
|
|
|
|
|
hi,
i am developing a web application where i am using asp:menu control to display menus.
ie version is ie7.
when there is less amount of data on a page the menu renders faster. Now for certain pages where i am using asp:Listbox control, when there are many items in the listbox control, the menu items are displayed slow. it takes some seconds to display the child menu items onhover. when there are lesser items in listbox the menu control render fast. This happens in ie7,but in ie6 that is not an issue. the menu displays faster in ie6 even when there is large amount of data in listbox
Sandeep Kumbhar
|
|
|
|