|
Hello!
One thing that comes to mind is to convert the number to a string and then search for the decimal separator:
int FractionDigits(double d)
{
string s = d.ToString();
int i = s.IndexOf(System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator);
if (i<0)
return 0;
else
return s.Length-i-1;
} The maximum number you'll get depends on how double.ToString() formats your number. Usually you'll get up to 15 digits, but that's enough for most practical cases.
Regards,
mav
|
|
|
|
|
Hi,
Please anyone tell me, how can i include an image in my C# project and refer it.
Currently i am referring to a image in my hard drive, but i wish to include it in my project as a resource.
Any help will be appreciated..
Thanks in advance.
*** Who said nothing is impossible? I have been doing it for a long time ***
|
|
|
|
|
You can check out the "Making it pretty" section of Building the CVS Root File Changing Utility.
In short, you add the image to your project, make it an embedded resource, and then use GetManifestResourceStream to get the image.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
Gee thanks man..
That was a lot of help.
I'll try it out and tell you tomorrow.
Thanks a lot.
*** Who said nothing is impossible? I have been doing it for a long time ***
|
|
|
|
|
OK. I have followed the simple examples found to produce a C# dll, which I can then use with RegAsm to produce a tlb file....and the end result is that I can call the original C# from within ASP/VB6. This all works fine.
However, if I amend the simple Library project to include a reference to a web service and follow the same steps (Adding a strong name file, compiling and running regasm), I end up with a strong name key error when using RegAsm. I have tried both manually compiling and also from the project.
So, I have tried separately creating a proxy class using wsdl...and then compiling this cs file into a dll, and then setting a reference to this dll in a separate servicedcomponent project. When compiling I get 'Assembly generation failed -- Referenced assembly xyz does not have a strong name'. Therefore I assume I need to apply the strong name separately to the Web Service Reference before compiling my ServicedComponent?
Fine, so I go back to the web consumer cs file, and compile it using csc /target module so that I get a netmodule, and then use Al.exe to try and link the module with the strong name. To use Al.exe I pass in the name of the dll/strong name file....and the 'Unspecified Error' that comes back complains about the original cs file which was used to create the netmodule!
Any ideas?
|
|
|
|
|
OK, I have managed to run this again and avoid the error from the the Al.exe.
|
|
|
|
|
I'm trying to fill a dataset with a DataAdapter.
OracleCommand cmd = new OracleCommand(cmdStr, conn);<br />
OracleDataAdapter oda = new OracleDataAdapter(cmdStr, conn);<br />
DataSet ds = new DataSet();<br />
oda.SelectCommand = cmd;<br />
oda.Fill(ds);
For whatever reason, it gives me this error:
Oracle.DataAccess.Client.OracleException: ORA-00903: invalid table name
Can someone help me?
Stack Trace:
<br />
Line 104: DataSet ds = new DataSet();<br />
Line 105: oda.SelectCommand = cmd;<br />
<big>Line 106: oda.Fill(ds);</big><br />
Line 107: dgWHR.DataSource = ds;<br />
Line 108: dgWHR.DataBind();<br />
[OracleException: ORA-00903: invalid table name]<br />
Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure)<br />
Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, String procedure, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src)<br />
Oracle.DataAccess.Client.OracleCommand.ExecuteReader(Boolean requery, Boolean fillRequest, CommandBehavior behavior)<br />
Oracle.DataAccess.Client.OracleDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)<br />
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)<br />
WhoHasRoutes.WebForm1.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\ferrellgas\whohasroutes\default.aspx.cs:106<br />
System.Web.UI.Control.OnLoad(EventArgs e)<br />
System.Web.UI.Control.LoadRecursive()<br />
System.Web.UI.Page.ProcessRequestMain()
Thanks in Advance
Scott
|
|
|
|
|
Hello,
It is nothing to do with DataAdapter. It seems that the db query contains invalid table name.
According to ora-codes.com
ORA-00903: invalid table name
Cause: A table or cluster name is invalid or does not exist. This message is also issued if an invalid cluster name or no cluster name is specified in an ALTER CLUSTER or DROP CLUSTER statement.
Action: Check spelling. A valid table name or cluster name must begin with a letter and may contain only alphanumeric characters and the special characters $, _, and #. The name must be less than or equal to 30 characters and cannot be a reserved word.
Maqsood Ahmed - MCAD.net
Kolachi Advanced Technologies
http://www.kolachi.net
|
|
|
|
|
My query is a query with a bunch of nested Select statements.
When i run the query in PL/SQL developer it returns results fine. Direct copy / paste.
|
|
|
|
|
Try simplifying the SELECT statement to use fewer nested queries. I don't know for sure, but you might be limited to a single SELECT keyword when using a DataAdapter...? Anyone, feel free to correct me here!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-- modified at 12:03 Thursday 22nd December, 2005
|
|
|
|
|
Hello,
Can you paste the db query here. There might be something related to string manipulation in C# or .net related issue.
Cheers.
Maqsood Ahmed - MCAD.net
Kolachi Advanced Technologies
http://www.kolachi.net
|
|
|
|
|
My registration page contains fields,register submit button and also a user control inside this page. i have username, password fields and Login submit button in this user control. in both user control and registration page i have used RequiredFieldValidator. so, when i try to login to my application by providing userid and password it is not entering into the application because it is validating registration page required fields and also if i fill all required fields in registration page and when i click on register submit button the records are not saving it is validating login screen required fields. how do i correct this problem? since i cannot validate fields in javascript because it is a multilingual application. pls. help me out.
|
|
|
|
|
Try implementing the validation controls in the user login control itself.
|
|
|
|
|
How can i send and Receive Messages from one application to another or passing a varaible from one application to another
Amit Grover
CDAC R&D
|
|
|
|
|
|
i would like to use winAPI instead of Inter-Process Communication in .NET Using Named Pipes,. plz send me e.g if possible
Amit Grover
CDAC R&D
|
|
|
|
|
A.,
I don't think anyone on this board will give a shrink-wrapped solution to your problem. Interprocess communication can get messy depending on how you implement it. If you don't already understand what you're doing, then you need to get some education regarding the matter.
However, you have a lucky star over your head because I found two articles right here on CodeProject that you can read. You will then know for what you ask and two methods for doing it in the Win32 API.- Interprocess communication tutorial, by Alex Fr
- Interprocess Communication using Shared Memory, by Zoran M. Todorovic
Now that I've helped you find articles, you need to help yourself by reading them.
I gather that you don't know how to make calls to the Win32 API from C#. I will start you in the right direction: search this site or the Internet for "p/invoke". You will find what you need.
Sincerely,
Curtis Schlak.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
|
i am looking for win32 api functions for send and recieve messages
Amit Grover
CDAC R&D
|
|
|
|
|
|
you have send me the way i can send message to another application. than how can another application receive that message.
Amit Grover
CDAC R&D
|
|
|
|
|
.Net Remoting is the answer if both the applications are written in .Net(which i assume so).
Here is the link for a basic over view of .net remoting Click Here
|
|
|
|
|
i would like to use winAPI instead of remoting and socket programming. plz send me e.g if possible
Amit Grover
CDAC R&D
|
|
|
|
|
I keep hearing people say to use Remoting to send data/messages between two processes/programs/whatever yet everything I've seen talks about running a routine in the server. Nobody talks about how to get the server to respond to a message.
In other words - you have an app that wants to send a message to another app saying 'There's new data available for you.' With remoting you can call a routine on the server but then how does the server know that there's been a change? It seems to me like the only thing you are doing is calling a remote routine but it doesn't provide communication with the host; the routine is segregated from the host.
Am I reading this wrong?
|
|
|
|
|
Hi.
I need a code sample that can mute the sound of windows in my applioation, please.
Best wishes
|
|
|
|