|
If any strings get changed in the unmanaged code you have to use a StringBuilder object.
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
"This time yesterday, I still had 24 hours to meet the deadline I've just missed today."
|
|
|
|
|
Thank you. i'll test that as soon as i can
this marshalling thing still confuses me a bit. do i have to tell the clr how to marshal the stringbuilder, or should it work when i leave all the marshalAs attributes away?
m@u
|
|
|
|
|
Hi,
Is the fact that your method return types are different, int vs. void, relevant or is that just a typo in the post.
Alan.
|
|
|
|
|
Hi,
yes that's a typo in the post. sorry.
the problem seems now to be solved. the guy who wrote the library said it's because the library uses delay load (what ever that means...).
we have now a version of the dll that works with c#
thanks
m@u
|
|
|
|
|
Hello,
I am trying to write a service in .NET 1.1 and .NET 2.0 which will catch a event and send it to SQL DB.
The issue is with .NET 1.1 service, the service on .NET 2.0 has no issues and is running without any problems. The service running under .NET 1.1 has a memory leak. I found out that when I use the property "EventLogEntry.Message", .NET 1.1 create for each entry 2 string variables with values "HKLM\System\CurrentControlSet\Services\EventLog". The second string is the same value only on the end of the string is the name of the eventlog file to which a event was written. Does anybody know if this is a bug in the .NET 1.1 framework or do I made a misstake somewere ?
This is a portion my code:
QueryApp = "INSERT INTO " + ComputerName + "_Application" +<br />
" (Category,CategoryString,EventCode,EventType,SourceName,TimeGenerated,TimeWritten,Message,UserName) values " +<br />
"(" + currentEntry.CategoryNumber + ",'" + currentEntry.CategoryNumber.ToString() + "'," + currentEntry.EventID + ",'" + Convert.ToString(currentEntry.EntryType) + "','" + currentEntry.Source +<br />
"','" + currentEntry.TimeGenerated.Month.ToString() + ". " + currentEntry.TimeGenerated.Day.ToString() + ". " + currentEntry.TimeGenerated.Year.ToString() + " " + currentEntry.TimeGenerated.Hour.ToString() + ":" + currentEntry.TimeGenerated.Minute.ToString() + ":" + currentEntry.TimeGenerated.Second.ToString() +<br />
"','" + currentEntry.TimeWritten.Month.ToString() + ". " + currentEntry.TimeWritten.Day.ToString() + ". " + currentEntry.TimeWritten.Year.ToString() + " " + currentEntry.TimeWritten.Hour.ToString() + ":" + currentEntry.TimeWritten.Minute.ToString() + ":" + currentEntry.TimeWritten.Second.ToString() +<br />
"','" + currentEntry.Message.Replace("'", "''") + "','" + currentEntry.UserName + "')";<br />
OleDbCommand commandApp = new OleDbCommand(QueryApp, connection);<br />
commandApp.ExecuteNonQuery();<br />
commandApp.Dispose();<br />
commandApp = null;<br />
QueryApp = null;<br />
if you need to see the whole code just tell me I will pase the whole function.
Thank you
Martin
|
|
|
|
|
hi frns
below is the code snippet i used in my proj actually i'll be giving some decimal value in the textbox input. I want to insert that textbox value into my database table. In the database i used that particular column as datatype decimal with precision 5 and scale 2.
SqlParameter pErrorPoints = new SqlParameter("@ErrorPoints", SqlDbType.Decimal);<br />
pErrorPoints.Value = decimal.Parse(txtPoints.Text.Trim());
if anybody knows the answer please do let me know
regards
sunilwise
|
|
|
|
|
sunilwise wrote: pErrorPoints.Value = decimal.Parse(txtPoints.Text.Trim());
Hi,
these are two ways to do that.
Convert.ToDecimal(txtPoints.Text.Trim()) <br />
<br />
or <br />
<br />
Decimal.Parse(txtPoints.Text.Trim()) <br />
Thanks,
Sun Rays
Rate this post if you like answer.
My Articles
|
|
|
|
|
Sun Rays wrote: Convert.ToDecimal(txtPoints.Text.Trim())
or
Decimal.Parse(txtPoints.Text.Trim())
ok i got it both are working
my thanx to all those have answered my question from the bottom of my heart
|
|
|
|
|
sunilwise wrote: decimal.Parse(txtPoints.Text.Trim());
What is your question ? I see you are doing a conversion here.
|
|
|
|
|
You don't actually need to convert the value to a decimal to use it in a SqlParameter.Value. The conversion is useful to prove that it is a decimal, but isn't actually needed by the system.
|
|
|
|
|
be sure that you wrote only numbers in the TextBox.
or set it in the try catch to see what is the problem
spaps
|
|
|
|
|
I don't see your problem, but you can use Decimal.TryParse() to be sure that you have a decimal value in your textbox and avoid errors in your application.
Hope it helps.
I will use Google before asking dumb questions
|
|
|
|
|
|
Would you ask a more meaningful question please?
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
"There is no wealth like knowledge, no poverty like ignorance." Ali ibn Abi Talib
"Animadvertistine, ubicumque stes, fumum recta in faciem ferri?"
|
|
|
|
|
where i find example please please please !!
|
|
|
|
|
where i find example please please please !!
|
|
|
|
|
Example of what? What you want to achieve? What's your goal? When you can answer those questions, post here for guidance.
I will use Google before asking dumb questions
|
|
|
|
|
This is a nice and free Download Manager Flashget[^]
|
|
|
|
|
it send data to tcp/ip port number, ex 8080, now i want to write socket program to read data from that port. Any body help me? How can i do that?
Thanks,
|
|
|
|
|
Create a new socket, bind it to 8080 port and use the Accept or BeginAccept methods (synchronous or asynchronous). When you have accepted a socket use the Receive or BeginReceive methods to read from that socket.
I will use Google before asking dumb questions
|
|
|
|
|
|
Why do everyone want to have their problems resolved by others with no sweat at all? Search the web and MSDN. I gave you enough hints. MSDN also has a few examples
I will use Google before asking dumb questions
|
|
|
|
|
Andrei - a 5 from me for the answer you originally gave.
|
|
|
|
|
Thanks.
I will use Google before asking dumb questions
|
|
|
|
|
He's sent you enough information for you to go and do some research on your own on google. That's the way this site works, it's not rentacoder where people give you code in exchange for money.
|
|
|
|