|
Well, you can get the freeware version of CodeSmith (with templates) here. http://www.codesmithtools.com/freeware.aspx[^]. We have our own templates that have been developed and tested over a couple of years of seriously heavy duty use, but the standard templates are pretty decent. There is a thriving community of CodeSmith template writers on the web.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
|
In our company we return data from the data layer as lists of strongly typed objects, and testing has shown that this is around 20-30% faster than using data tables.
It's not really the performance that is most appealing, but the type safety. My experience is that it makes it much easier to write, debug and maintain the applications.
---
Year happy = new Year(2007);
|
|
|
|
|
Hi,
I'm sorry to say this, but all these information got me confused. Pardon me, i'm a person with less than an year experience in programming.
Does all these posts mean collection are better. We already have implemented a part of our product using collections (3 tier), but its very slow and client now wants old VB 6.0 applicatio, it was lot faster...
I'm assigned this job to make a report on the reason of poor performance of our .NET application. When i used a datatable to return values from data layer to presentation layer, application was 70% faster.. The SQL query is fine, I tested it in Oracle..
Any ideas?
Blumen
|
|
|
|
|
Unfortunately it gets down to a question of experience and profiling. You need to look at how much data you are returning - are you pulling back more than you need to? What are you using to populate the collection? Are you using a DataReader to populate the collection, or are you using a DataSet/DataTable? Are you using web-services and passing data backwards and forwards between layers?
This last one is important because you need to serialize the data to pass over the wire (and then deserialize at the other end), and this serialization takes time. One of the commonest problems I have seen is people architecting systems using web-services when they don't need to.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi,
Thanks for the reply, I rally appreciate it. This is what we currently do:
1. From Presentation layer, we call a function in Business Layer and pass the business object to it.
2. From the business layer we pass this businees object received from step 1 to Data Access Layer.
3. In the Data Access layer we call the Oracle Stored Procedure.
In Step 2, we receive a Data as DataTable from Data Access layer. Here we convert it to a collection and send it to Presentation layer and this data collection is given as DataSource to the DataGrid. We use .NET Framework 1.1 SP1 with VS 2003.
We are in to health care domain, and in the above example you can consider the business object to be "Patient" in a hospital or a list of doctors or medecal history of a patient(s). This is the scenario we have at office.
I hope I'm more descriptive this time
But data retreival is pretty slow, once we Click the Search or Save button in a Windows Form, its takes some time before data appears in the Grid. And we have to refresh the data in the grid with user interaction (say when user changes doctor from the combo box), so that makes the application slower!
Considering the above situation, which data object would be best - Typed DataSet, normal DataSet, Collection, or DataTable.
Regards,
Blumen
I want to become a software consultant one day, a person who can solve any issues with design, architecture, and the application..
|
|
|
|
|
Your problem is most likely in stage 2. You are retrieving data into a DataTable and then you are converting it into a collection. This is very expensive. If I were you, I would retrieve the output from the SP using a DataReader and then I would populate the collection directly from this.
A DataReader serves data as what we normally term a firehose cursor. In other words, the data can only be read in one direction and it is typically the fastest way to get data out. More importantly, you can put this retrieval onto a different thread so at some point, you could start displaying some of the information back in the grid.
I hope that this helps.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hello Pete,
That was really helpful. On Monday I will try what you suggested, I will retrieve data using a DataReader and populate the collection directly. That sounds really good.
I have read in some online article that retrieving data using DataReader is not safe, don't remember what they meant, I read it long time back. Which is better way to retrieve data, using DataReader or DataAdapter, or is their another way?
I really appreciate that you have replied.
Regards,
Blumen
|
|
|
|
|
I've never found the DataReader to be unsafe. It's the method that I normally use. I suspect that what you have read is more to do with concurrency.
Anyway, good luck and I hope that it works out. And if you need more help, don't forget to post.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi Pete,
I believe what you are saying is correct, DataReader should be safe, after all Microsoft would not release it just like that!
But what was the concurrency issue you were referring to?
Regards,
Blumen
|
|
|
|
|
Blumen
The issue relates to the underlying data being changed as you iterate through the datareader. This normally occurs when somebody else changes a record that you are interested in. If you don't have your transaction isolation level set accordingly (take a look in the Oracle docs for this), you can get issues.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Pete, I think this is the reason why the guys here use Adapter to fill a DataTa
ble and then make a collection.
Have to investigate more.. Is there anyway I can contact u, any e-mail ids or chat ids, if you don't mind?
Blumen
blumenhause@yahoo.com
|
|
|
|
|
Guys,
I have a weird problem.
1.
We have a windows service running on the computer.
This service actually manages services that are related to our core application (We can call up a gui and add new services into this one).
2.
In order to customize our core application we can interact with it via a tlb file.
So I've written a little application that can interact with our core application (press buttons, select items, read/write from/to fields,...)
To do this I have a wrapper dll that calls CreateObject to create the object.
I built in a check to make sure the core application is running, because else it would be started. (We don't want to start it that way)
All works fine until I add my custom application to this service manager. It passes the check that our application is running, but will still fire up a new instance of our core application.
Apparently he can't attach to the existing application or something?
Why is this happening? What's the cause?
Is there a way around this?
I hope my explanation was clear, thanks in advance for your help !
V.
I found a living worth working for, but haven't found work worth living for.
|
|
|
|
|
hello all,
I am trying to save of importing a dataView to Excel file. dose anybody now how?
discription:
first I did a select to an Excel file and then I made a DataView of those selected rows and now I want to save that DataView as a Exel file.
-- modified at 8:29 Thursday 18th January, 2007
|
|
|
|
|
Hi
This is the code to Export data to excel file from table in vb.net
Public Sub XportToXcel(ByVal dt As DataTable)
Try
Dim XApp As New Excel.Application
Dim XBook As Excel.Workbook = XApp.Workbooks.Add
Dim XSheet As Excel.Worksheet = CType(XBook.Worksheets(1), Excel.Worksheet)
XApp.Visible = False
With XSheet
Dim c As Long = Asc("A")
For Each dc As DataColumn In dt.Columns
.Cells(1, c).Value = dc.ColumnName.ToString
.Cells(1, c).Font.Bold = True
c += 1
Next
Dim i As Long = 2
For Each dr As DataRow In dt.Rows
c = Asc("A")
For Each dc As DataColumn In dt.Columns
.Cells(i, i - 1).Value = dr.Item(dc.ColumnName)
c += 1
Next
i += 1
Next
XApp.Visible = True
End With
Catch ex As Exception
MessageBox.Show("Source [" & ex.Source & "] Description [" & ex.Message & "]")
End Try
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
XportToXcel(DataGrid1.DataSource)
I hope this will idea for u r problem
Have a Nice day
|
|
|
|
|
Hi All,
I am using HttpWebRequest and HttpWebResponse object to upload a file over HTTPS Channel.
My code works fine when I upload a small size file (Less than 2K). When I try to upload a bigger file, HttpWebRequest is Timing Out.(The operation has timed-out.)
Here is the snippet of the code I am using
HttpWebResponse Resp = (HttpWebResponse) Req.GetResponse(); Stream responseStream = Resp.GetResponseStream(); Encoding enc = Encoding.GetEncoding(1252); // Windows default Code Page
StreamReader loResponseStream = new StreamReader(responseStream,enc);
string stringResponse = loResponseStream.ReadToEnd();
LogFileStream.WriteLine("Http Response: " + Resp.StatusCode + " " + DateTime.Now.ToString().Trim()+"\n");
responseStream.Close();
oResponseStream.Close();
Does any body having clue what to do in such kind of scenario??
Thanks in advance.
Satya
Satya
|
|
|
|
|
I am using a calendar control in my application(Visual Studio 2005, C# .NET 2.0). As per the control, clicking on the calendar textbox, a calendar should popup just below the textbox. I am facing two problems with the control. First problem is, when I am clicking on the text box(calendar control) the calendar is popping up but it is displaying under the other controls below. Second problem is, if I am using more than one date control in the same page, one of the calendar is getting displayed in top left corner of the page permanently. The calendar control is inside a "div" tag. Is this the problem?
|
|
|
|
|
Using Globalisation for ASP.Net Can a Web appplication can take the user input in different laguages. Like for example my culture is fr-Fr french then Can a user enter the data in french in the textbox control.
sj
|
|
|
|
|
UICulture has no connection with the language the user can use for entering data. The user can even enter data in Chinese. UICulture is used to display the correct date format etc on a website.
|
|
|
|
|
hello all
i'm working with panels.
i've added some textboxes and labels on panels. there are multiple panels on one form.when i hide a panel i want to hide all controls on that panelm too
how do i do this??/
plz reply
Saira
|
|
|
|
|
If you hide a panel, it should hide all the controls as well. If this is a web app, a PlaceHolder is the best way to group things so they all show and hide together.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
If you set panel.Visible = false, then all controls in that panel will be invisible too.
|
|
|
|
|
i'm using the visible poperty to hide the panel but it doesn't hide the controls on the panel.
is there any other way other than through the visible property.
|
|
|
|
|
Hi, Everyone
I have bound dataGrid1 with using dataset1.
kindly help me about mentioned two problems:
1) when I click on any cell. it is already set with edit mode. How may I turn off edit mode?
2) When I bind dataGrid1 with dataset1, after loading project i have to collap it manualy. Why does it not collap automatic?
please give solutions about said problems.
thank you
My source code
==============
namespace WindowsApplication1
{
public partial class Form1 : Form
{
private DataTable dataTable1;
private OleDbConnection oConnOLEDB = new OleDbConnection();
private OleDbDataAdapter oAdapter1 = new OleDbDataAdapter();
private OleDbDataAdapter oledbSelectCMD = new OleDbDataAdapter();
private DataSet dataset1 = new DataSet();
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
try
{
oConnOLEDB.ConnectionString = "Provider=MSDAORA.1;Data Source=ORVB;Persist Security Info=True;User ID=RIAZ;Password=SMS";
oConnOLEDB.Open();
}
catch (OleDbException ex)
{
MessageBox.Show(ex.Message, ex.Source, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void button1_Click(object sender, EventArgs e)
{
String strSQLCommand = null;
strSQLCommand = "SELECT * FROM ADMIN.SCHEDULE ORDER BY TDATE DESC";
dataset1.Clear();
oAdapter1 = new OleDbDataAdapter(strSQLCommand, oConnOLEDB);
oAdapter1.Fill(dataset1, "SCHEDULE");
dataGrid1.SetDataBinding(dataset1, null);
}
}
}
|
|
|
|
|
1) Make your datagrid readonly
2) Use DataSet.Tables[0].DefaultView.
Jayant D. Kulkarni
Brainbench Certified Software Engineer in C#, ASP.NET, .NET Framework and ADO.NET
|
|
|
|