|
the codes are not compiling properly.
If u agree i ll send the codes,ve a look in to it.
http://www.netbook.cs.purdue.edu/code/code30_1.htm (for client code)
-- modified at 11:18 Wednesday 1st February, 2006
|
|
|
|
|
http://www.parashift.com/c++-faq-lite/how-to-post.html#faq-5.2
|
|
|
|
|
|
|
I don't understand the problem. You have to build a control. You put in a numUpDown and a label for the number if you don't want to have a textbox. Then catch the KeyEvents. If a number is typed change the value. You might have to catch the Events from the Form and then change your controlvalue.
Or did I missunderstood your question?
Greetings,
Ingo
|
|
|
|
|
Hello,
I have a method that executes the given SqlCommand and returns the command result as a DataSet, while the method works under heavy load SQL Server (2000 Enterprise SP3) memory usage goes through the roof.
After some investigation I found that connections were being left active in the database. "Proof" of this was found after running a load test, a few minutes after the test completes (and while there is not activity on the SQL server) SQL Profiler shows various "Audit Logout" entries
EventClass : Audit Logout
TextData :
ApplicationName : LoadTestRun1
NTUserName : NETWORK SERVICE
LoginName : sa
CPU : 0
Reads : 10
Writes : 0
Duration : 459920
ClientProcessID : 0
Spid : 2969
StartTime : 2006-02-01 15:16:12.987
After hunting around various sites and tutorials this is the SqlCommand execution method:
public static DataSet ExecuteSqlCommand(SqlCommand command, string dataSetName)
{
if (command == null)
{
throw new ArgumentNullException("command");
}
if (dataSetName == null)
{
throw new ArgumentNullException("dataSetName");
}
DataSet returnDataSet = new DataSet();
returnDataSet.DataSetName = dataSetName;
returnDataSet.Locale = CultureInfo.InvariantCulture;
try
{
SqlDataAdapter sda = new SqlDataAdapter(command);
sda.Fill(returnDataSet);
sda.Dispose();
sda = null;
return returnDataSet;
}
catch
{
throw;
}
finally
{
if (command.Connection.State != ConnectionState.Closed)
{
command.Connection.Close();
}
command.Connection.Dispose();
command.Connection = null;
command.Dispose();
command = null;
}
}
Can anybody tell me if there is anything obviously wrong with my implementation or if there is something else I should check for.
|
|
|
|
|
//Perhaps this might work. Although I saw nothin in your post that would leave
//an open connection Remember the connection pool will remain for reuse but
// that's a good thing
try
{
SqlDataAdapter sda = new SqlDataAdapter(command);
command.Connection.Open;
sda.Fill(returnDataSet);
command.Connection.Dispose();
command.Dispose();
sda.Dispose();
return returnDataSet;
}
catch
{
throw;
}
finally
{
}
"People who never make mistakes, never do anything."
My Blog
|
|
|
|
|
It is generally good practice to put anything that is being disposed in the finally block so that it is still run if an exception is thrown.
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
yes you are correct ... silly me.
"People who never make mistakes, never do anything."
My Blog
|
|
|
|
|
I'm trying to string several arrays together. Here is my code.
<br />
public void OnCreateMessage(string TermID, string AddressLine, string MessageText)<br />
{<br />
private byte[] HeaderBegin = new byte[]{0xFF, 0x00, 0xAA, 0x55, 0x00, 0x1E, 0x48, 0x02, 0x00, 0x01, <br />
0x4C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, <br />
0x08, 0xD2, 0x00, 0x00, 0x00, 0x00};<br />
private byte[] HeaderEnd = new byte[]{0x55, 0xAA, 0x00, 0xFF};<br />
<br />
Encoding enc = Encoding.ASCII;<br />
uint nTermID = (uint)Encoding.ASCII.GetByteCount(TermID);<br />
uint nAddressLine = (uint)Encoding.ASCII.GetByteCount(AddressLine);<br />
uint nMessageText = (uint)Encoding.ASCII.GetByteCount(MessageText);<br />
string sMyMsg = TermID+ASCII.CR+ASCII.LF+AddressLine+ASCII.CR+ASCII.LF+MessageText;<br />
byte[] myBytes = enc.GetBytes(sMyMsg);<br />
byte[] MyMsg = new byte[30+nTermID+nAddressLine+nMessageText+4];<br />
<br />
MyMsg = HeaderBegin;<br />
myBytes.CopyTo(MyMsg, 26);<br />
HeaderEnd.CopyTo(MyMsg, MyMsg.Length);<br />
However when I step thru my code there is nothing in the MyMsg. Am I doing something wrong?
Thanks for any suggestions.
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
RTFM
The second parameter of the CopyTo method is the destination position, not the length.
---
b { font-weight: normal; }
|
|
|
|
|
ah..okay...That's what I'm doing,
first I move in headerbegins. 26 bytes in length.
then I move in myBytes which is a byte array of ASCII text, into MyMsg at postion 26.
Then I copy in HeaderEnd into MyMsg at the current length of MyMsg.
Is this wrong?
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Tom Wright wrote: Then I copy in HeaderEnd into MyMsg at the current length of MyMsg.
I think that's the problem. You are trying to copy elements starting from one past the last element in the array. MyMsg.Length doesn't represent the actual number of elements in that array, it's always fixed and is equal to the array size.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Yeah I see that..... I changed my code to this...
<br />
byte[] MyMsg = new byte[HeaderBegin.Length+myBytes.Length+HeaderEnd.Length];<br />
<br />
HeaderBegin.CopyTo(MyMsg, 0);<br />
myBytes.CopyTo(MyMsg, 26);<br />
HeaderEnd.CopyTo(MyMsg, MyMsg.Length+2);<br />
and I get an error saying that I do not have enough elements in my array. So how do I size my byte array to handle all of the different arrays that I need to copy into it?
Will bytesread give me a value that will resize my array correctly?
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Hi all,
a simple question.
i need to invoke a gui from a program. i can simply do
Application.Run(myForm);
the gui is started but the problem is how do i come to the next line of the code?
regards,
rnv
|
|
|
|
|
Are you tring to load a form from your main app? To do this you do something like.
NewForm newform = new NewForm();
newform.ShowDialog();
Once it it shows the form then in NewForm dialog in LoadForm you can have it start the next line of code you want.
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
thanks,
here is what i want. i have the main class which should invoke certain Form at certain moment.
when i do
1. NewForm newform = new NewForm();
2. newform.ShowDialog();
3. DisplayStatusInfo("Form Displayed");
it shows the dialog but it does not do the next step (3).
any idea?
regards,
rnv
|
|
|
|
|
So I'm not really sure what board this belongs on, because it could be an issue with one of many things(ASP, XP itself, the VSTO document), so I figure here might be as good a place as any to start. Feel free to point me elsewhere though.
I've written an excel VSTO client, that is being spawned by a webclient. On my local machine and the machine of the developer that was programming the webclient, everything works just fine. The problem is we can't get it to work on any other machine. We've set up the .Net permissions, and all the code is compiling fine, but upon trying to spawn the VSTO document on anyone else's machine, I get this:
Error: Request for the permission of type
‘System.Security.Permission.SecurityPermission, mscorlib
Version=2.0.0.0, Culture=neutral, PublicKeyToken = b77a5c561934e089’
Failed
Obviously, I've missed some configuration toggle that VSTO/VS.NET/Something automatically did for me, but I'm stumped as to what. If anyone knows why this is happening(I know its a security issue, but I thought I'd given it permission), and can point me in the right direction, it would be greatly appreciated
|
|
|
|
|
I am getting this error message:
Visual Studio cannot start debugging because the debug target 'C:\...\.viewPDF.exe' is missing. Please build the project and retry, or the outputpath and assemblyname properties appropriately to point at the correct location for the target assembly.
Its such a silly problem, because I have to rebuild everytime before running my application, why do you think?
|
|
|
|
|
|
cassie1 wrote: I am using visual studio C# 2005 and cannot get the code below to work i keep getting an error unable to find filename(C:/Program Files/Bernie/Accounts.xls,
you're using unix slashes not dos slashes in your path.
|
|
|
|
|
Thanks for reply dan but ive tried other way still wont work it will build with the code ive put forward.and the path is right because it works with a different code in visual studio 2005 express okay.
|
|
|
|
|
Does the error message contain the path that it's trying to use? Does that correspond to where the file is stored?
---
b { font-weight: normal; }
|
|
|
|
|
|
Are you sure? What does the error message look like?
---
b { font-weight: normal; }
|
|
|
|