|
|
I have a 3 tier (biz data and gui layers) web app.
Should I be destroying the BLL or DAL objects after I am none using them?
How come w3wp.exe on the server keeps growing as people use the web app?
Does the fact that none is destroying the objects when they use them have anything to do with it?
We recently moved to the QC box and I am very concerned with the mem usage of w3wp.exe going up as I am testing the site. I am the only user.
Thank you in advance for any advice.
Paixtis
|
|
|
|
|
pages are destroyed for you after a page is rendered to the client. Unless you have objects in Application, Session, or Cache you don't need to destrooy anything. What you're seeing with the w3wp process should be normal. It should expand and contract in size based on use.
|
|
|
|
|
Thank you for your feedback.
This is also my understanding for the .Net environment.
Here is also my concern. One user (me), browing a handful of pages balloed the resources used by w3wp to 80MB. I killed the session and nothing was released.
What heppens if 5 users access thensystem at the same time? I am going to set up a similar test, but I am interested in your theory/comments.
Thanks
Paixtis
|
|
|
|
|
IIS is designed for multiple clients accessing resources at the same time. Check your IIS settings for optimization. It can handle thousands of users, certainly 5 shouldn't be an issue.
|
|
|
|
|
Please provide me advantages/disadvantages regarding the Data Access Application Block in Enterprise Library.
.... From russia with love ....
|
|
|
|
|
Please avail yourself of the many sources of information on the internet. Look on the MSDN website[^], or just Google 'DAAB Enterprise Library'.
There are also probably relevant articles on CodeProject.
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
|
|
|
|
|
:->
I want to use picturebox control to display a image file on a dialogue with C#.I don't
know how to display any part of the image by changing the picturebox property.
Anybody can give me some help.
THANKS IN ADVANCE!
E-MAIL : LYHM5.2@GMAIL.COM
|
|
|
|
|
To display an image in the pciturebox,
myPictureBox.Image = Image.FromFile("something.jpg");
Is that what you're looking for? You might try searching CodeProject and MSDN articles before posting.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: He has a funny face. And he's my son.
Judah Himango
|
|
|
|
|
Thank you for your help.I just want to partly display the image ,not all the image.
:->
|
|
|
|
|
I don't think there's anything built into the framework for this; just grab the part of the image you want and construct a new image from it.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: He has a funny face. And he's my son.
Judah Himango
|
|
|
|
|
Hi!
I got a litte problem with an interface.
An interface-declaration is provided in an DLL.
Application A loads at runtime a DLL with a class that implemented the interface mentioned above.
I have got this until now:
// works perfect
object oGen= (object) Activator.CreateInstance((cGenAssembly.GetTypes())[1]);
TheInterface iInt= oGen as iInt;
if (iInt== null)
{
MessageBox.Show("Error");
}
else
{
// Do some stuff
}
I get an InvalidCastException.
If I cast the generated object into a class (for example System.Windows.Forms.Form) i can call functions.
must I cast the generated object into the correct class and afterwards i can create the interface or is there another possibility?
thanks for your help
INT 19H
|
|
|
|
|
|
Sorry, my fault.
But even this Method doesn't work.
53746F6E65
INT 19H
|
|
|
|
|
The simple answer in that case is that the object you are creating either does not implement that interface, or it cannot be cast to an object which implements that interface.
I suggest using the debugger to determine exactly what object is returned from your Activator.CreateInstance call.
|
|
|
|
|
If its marshalled from another appdomain, i think you need CreateInstanceAndUnwrap, or unwrap the object it gives separately.
--
Joel Lucsy
|
|
|
|
|
Changed the creation code to:
object oGenForm = cCurrentDomain.CreateInstanceFromAndUnwrap("pathtodll", (cGenAssembly.GetTypes())[1].ToString());
and it still doesn't work.
53746F6E65
INT 19H
|
|
|
|
|
I am working on an app that uses a login form. The login form touches a database to validate the user. If the user chooses a cancel button on the login form a result flag is set to false and the login form closes. The main (calling) form tests the result and if it is false then the app should exit. That is where the following error occurs.
An unhandled exception of type 'System.ObjectDisposedException' occurred in system.windows.forms.dll
Additional information: Cannot access a disposed object named "frmMain".
Here is my code:
<br />
[STAThread]<br />
static void Main() <br />
{<br />
Application.Run(new frmMain());<br />
}<br />
<br />
public frmMain()<br />
{<br />
InitializeComponent();<br />
this.Show();<br />
frmLogin frm = new frmLogin();<br />
frm.ShowDialog();<br />
if (frm.LoginResult == false)<br />
Application.Exit();<br />
}<br />
What causes this, and how do I fix it?
|
|
|
|
|
Hi!
Could it be that you're coming from a VB background?
Remove this.Show(); from your frmMain constructor to get rid of the ObjectDisposedException .
But your main frame will show afterwards, even when LoginResult is false .
You could do it like this:
static void Main()
{
frmLogin frm = new frmLogin();
frm.ShowDialog();
if (frm.LoginResult == false)
return;
Application.Run(new frmMain());
} Regards,
mav
|
|
|
|
|
Is it that obvious?
Is there a way to make the main form show before the login form without causing an error?
|
|
|
|
|
Your naming convention and usage of Show gave a few hints
You could show the login dialog in the Load event handler of your main form.
If your login isn't successful, you can call this.Close(); to immediately close the form again.
Because the form usually is shown _after_ the OnLoad handler has finished, you won't see the main form until after the login dialog has closed.
You can, however, put this.Show(); at the beginning of your Load event handler to immediatly make the main form visible.
Regards,
mav
|
|
|
|
|
Hello all,
I created a access database programaticaly but i need to creat a table programaticaly too.please how can i do that.
Regards,
Hay
|
|
|
|
|
Hi!
SQL has a command for this: CREATE TABLE
I think you should read the documentation on the ADO.NET classes on how to use them.
Regards,
mav
|
|
|
|
|
Hello Mav,
Thanks so much for your help.
I know that the SQL has a command :Create table
I mean how can i do this with Code dynamicaly i tried this code put it return error.
using System;<br />
using System.Data;<br />
using System.Data.OleDb;<br />
using System.IO;<br />
namespace FrameworkExamples<br />
{<br />
class SampleADONETExecSQLAccess<br />
{<br />
static void Main()<br />
{<br />
OleDbConnection db;<br />
OleDbCommand dbcmd;<br />
string connstring;<br />
int recsaffected;<br />
StringWriter sql;<br />
connstring = "Provider=Microsoft.Jet.OLEDB.4.0;";<br />
connstring += @"Data Source=C:\Documents and Settings\Administrator\Desktop\db1.mdb;";<br />
db = new OleDbConnection(connstring);<br />
db.Open();<br />
sql = new StringWriter();<br />
sql.WriteLine("create table tbl1");<br />
sql.WriteLine("(");<br />
sql.WriteLine("id int identity(1, 1) not null primary key,");<br />
sql.WriteLine("field1 varchar(255) null,");<br />
sql.WriteLine("field2 bit null");<br />
sql.WriteLine(")");<br />
sql.Flush();<br />
dbcmd = new OleDbCommand();<br />
dbcmd.CommandType=CommandType.Text;<br />
dbcmd.CommandTimeout=30;<br />
dbcmd.CommandText=sql.ToString();<br />
dbcmd.Connection=db;<br />
recsaffected = dbcmd.ExecuteNonQuery();<br />
db.Close();<br />
dbcmd = null;<br />
db = null;<br />
sql = null;<br />
}<br />
}<br />
}
|
|
|
|
|
Ouch!
Why on earth are you using a StringWriter to build your SQL query?
Could it be that you thought of the StringBuilder class? But even then, your create table statement can be packed in a single string and thus be much more readable.
And the OleDbCommand can be created with one line, not 5 like in your code: OleDbCommand dbcmd = new OleDbCommand(db, commandText);
You shouldn't set your objects to null at the end of your function, but rather call their Dispose() methods so that resources are freed before the objects are garbage collected. This should be done even in an error situation, so using a try/finally would be a good idea.
If you get an error, knowing what the error is is essential to fixing it. I guess you're getting an OleDbException telling you that there's a syntax error somewhere. I don't remember all the data types for Access, but I think the line id int identity(1, 1) isn't syntactically correct. IIRC, you'll have to use counter instead of int identity(1,1) .
Regards,
mav
|
|
|
|