|
You can use sizeof in C# too, but only on value types.
There is no method to get the size of objects, as that rarely makes any sense. If you for an example do like this:
string s = new string('x', 50000);<br />
string[] a = new string[10000];<br />
for (int i=0; i<10000; i++) a[i] = s;
Now you have an array of 10000 strings that each uses 100 kb. That adds up to about one gigabyte. But as all the strings reference the same memory area, it actually only uses about 140 kb.
If you want the memory size of an array you have to add the items yourself, and if there can be items referencing the same object, you have to decide how to handle that.
---
b { font-weight: normal; }
|
|
|
|
|
Even in C++, sizeof does not always tell how much memory your object uses. For example, sizeof(some_pointer) only tells the size of the pointer variable, not the size of the instance it points to.
Best,
Jun
|
|
|
|
|
i want to generate table from sql script but dont know how to execute the sql script so i m using selected code from script file to generate table.
String strQuery="CREATE TABLE tblServer (ServerName nvarchar(50) NOT NULL,UserId nvarchar(50) NOT NULL,Password nvarchar(50) NOT NULL)";
SqlConnection conn= new SqlConnection(strConn);
conn.Open();
SqlCommand cmd=new SqlCommand(strQuery,conn);
cmd.ExecuteNonQuery();
conn.Close();
but it gives sql exception i dont know why.what i want to do is create table when app starts on sql server. if you tell me technique of executing sql srcipt file or other method
Tasleem Arif
|
|
|
|
|
the strQuery is correct...
so what is the exception ??
Tamimi - Code
|
|
|
|
|
it gives system.data.sql exception
Tasleem Arif
|
|
|
|
|
it could by the connection string format
Tamimi - Code
|
|
|
|
|
tasleem143 wrote:
but it gives sql exception i dont know why.what i want to do is create table when app starts on sql server. if you tell me technique of executing sql srcipt file or other method
Which line throws the exception? The exception should also give you more information that just sql exception. When you catch the exception what other information does the exception variable have?
Michael
CP Blog [^] Development Blog [^]
|
|
|
|
|
|
it works i had found where exception was.thanks for reply.
Tasleem Arif
|
|
|
|
|
hi!!
I am trying to build an application using .net and C# which will allow me to push objects from my desktop to all nearby devices. Its like a program to alert all nearby devices.
I have been trying to find ways to access the bluetooth stack on my desktop using .net but havent been able to do so.
Can any one tell me how can i achieve this?
thanks
p.s :I am eagerly waiting a reply ..its kinda urgent!!
|
|
|
|
|
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
this.SetStyle(ControlStyles.DoubleBuffer, true);
works for forms
but what about panel or other controls ?.. is there a way to stop the flickering while drawing on a paint event?
modified 30-Nov-21 21:01pm.
|
|
|
|
|
mihaila mihai wrote: this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
this.SetStyle(ControlStyles.DoubleBuffer, true);
SetStyle is inherited from Control so will work with all classes derived from Control at some point, so Panel yes, other controls almost certainly yes.
The Welsh will always support two teams: The Welsh, and anyone playing England
|
|
|
|
|
I'm trying to insert a record into a sql server 2000 database using a store
procedure (vs.net is my develop tool) on the button click event but I keep
getting the following error after clicking the button:
Object must implement IConvertible.
When i try to read TemplateColumns from datagrid and to insert in sql server table, i think is the problem.
I don't have any trace.
Code:
public void inscriereemail()
{
string conn = ConfigurationSettings.AppSettings["conn"];
SqlConnection objConnection = new SqlConnection(conn);
SqlCommand mycmd = new SqlCommand("add_email", objConnection);
mycmd.CommandType = CommandType.StoredProcedure;
lblint.Text = Request.QueryString["id"];
SqlParameter expeditorp=new SqlParameter ("@expeditor", SqlDbType.VarChar, 4);
expeditorp.Direction=ParameterDirection.Input;
expeditorp.Value= lbluser.Text;
mycmd.Parameters.Add(expeditorp);
SqlParameter destinatar1p=new SqlParameter ("@destinatar", SqlDbType.VarChar, 5);
destinatar1p.Direction=ParameterDirection.Input;
destinatar1p.Value = dgdest.Items[0].FindControl("lbldest"); <- Problemns
mycmd.Parameters.Add(destinatar1p);
SqlParameter destinatarp=new SqlParameter ("@destinatar_camion", SqlDbType.VarChar, 4);
destinatarp.Direction=ParameterDirection.Input;
destinatarp.Value= lblint.Text;
mycmd.Parameters.Add(destinatarp);
SqlParameter titlup=new SqlParameter ("@titlu", SqlDbType.VarChar, 25);
titlup.Direction=ParameterDirection.Input;
titlup.Value=txttitlu.Text;
mycmd.Parameters.Add(titlup);
SqlParameter mesajp=new SqlParameter ("@mesaj", SqlDbType.VarChar, 800);
mesajp.Direction=ParameterDirection.Input;
mesajp.Value=txtmesaj.Text;
mycmd.Parameters.Add(mesajp);
SqlParameter cititp=new SqlParameter ("@citit", SqlDbType.VarChar, 1);
cititp.Direction=ParameterDirection.Input;
cititp.Value = "1";
mycmd.Parameters.Add(cititp);
SqlParameter trashp=new SqlParameter ("@trash", SqlDbType.VarChar, 1);
trashp.Direction=ParameterDirection.Input;
trashp.Value = "1";
mycmd.Parameters.Add(trashp);
SqlParameter data_adaugarep=new SqlParameter ("@data_adaugare", SqlDbType.VarChar, 35);
data_adaugarep.Direction=ParameterDirection.Input;
data_adaugarep.Value = lblTime.Text;
mycmd.Parameters.Add(data_adaugarep);
try
{
objConnection.Open();
mycmd.ExecuteNonQuery();
}
finally
{
if (objConnection.State == ConnectionState.Open)
{
objConnection.Close();
}
}
}
|
|
|
|
|
ujupanmester wrote: destinatar1p.Value = dgdest.Items[0].FindControl("lbldest"); <- Problemns
destinatar1p.Value = ((Label)dgdest.Items[0].FindControl("lbldest")).Text;
|
|
|
|
|
Thanks.
Your code work fine and thanks a lot because you help me.
|
|
|
|
|
hi all
i have 2 com+ is A AND B
i want if client can call B have to after call A
if client call B will have Exception
Ex:
if client call A
after call A will return for client
C = New B
return C
Client call
B b = C
---------------
if Client call
B b = new B;
will Exception
-- modified at 6:35 Saturday 24th June, 2006
|
|
|
|
|
Please post it to COM forum.
Best,
Jun
|
|
|
|
|
Hi everyone,
______ 1 _______
| |<----------->| |
| | 2 | |
|______|<----------->|_______|
Client machine Web Service
Webmethod 1 and Webmethod 2 are being called here.
I want to make both happened in a single transaction.i.e "1" also should rollback if "2" has failed.
I can't open a connection object in the client.Its been opened in the webservice.
1
|<----------> [webmethod A (Transaction) ]
client app | 2
|<----------> [webmethod B (Transaction) ]
Here after 1 the transaction will be over in normal scenarios ,which should not happen
How do I achieve this.
Thanks in advance
-- modified at 14:13 Saturday 24th June, 2006
|
|
|
|
|
if I drag an Outlook.MailItem to a Windows-Explorer window a
<subject>.msg file will be created.
Now I try to drag & drop a mail item to my own WinForm app.
Unfortunately it doesn't work.
Any ideas?
|
|
|
|
|
Standard question #1:
What do you mean by "not working"?
You have to enable drag-and-drop for the controls in your form that should recieve them. Then you implement the events that handles it.
---
b { font-weight: normal; }
|
|
|
|
|
When I drag a mail from outlook to MSWord an attachment will displyed in MSWord. I need the same thing in C# application.
Thanks
Ramana
|
|
|
|
|
Sometimes it feels like someone replying to a post of mine didn't read my post at all. This is one of those times.
---
b { font-weight: normal; }
|
|
|
|
|
Guffa wrote: You have to enable drag-and-drop for the controls in your form that should recieve them. Then you implement the events that handles it.
So, in your C# application, set the necessary control to handle the drag-in-drop.
|
|
|
|
|
|
Hi,
I want to dynamically load some assemblies and invoke certain functions given in those assemblies. All these functions will implement the same interface, so that I don't have to bear the performance hit of a Type.InvokeMember call. For loading these assemblies dynamically I will, obviously, have to use the Assembly.Load/LoadFrom routines.
My question is, is it advisable to put some assemblies (which may be dynamically loaded frequently) into the GAC or have some sort of a replacement algorithm (like LRU) to add and remove these assemblies from the GAC ? Also, if I put these assemblies into the GAC, will the Assembly.Load/LoadFrom routines check the GAC first while searching for the assembly or will I have to query the GAC to find whether the requested assembly exists in the GAC or not and then proceed?
Thanks for any thoughts or help.
Cheers
|
|
|
|