|
Try using the NumberStyles enum in the System.Globalization namespace to parse that text.
float b = float.Parse(ExpNumString, NumberStyles.AllowExponent|NumberStyles.Float);
|
|
|
|
|
Hi all,
In my app i have 1 class call sqlconnection which is use for get/update db data. I am use this class to get dataset and after i edit the dataset i will pass back to this class and update it.Example, call sqlconnection method from formA to get and update database:
class sqlconnection:
private OleDbConnection objConn;<br />
private OleDbDataAdapter objAdapter = new OleDbDataAdapter();<br />
<br />
public void DbConnection()<br />
{<br />
objConn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;DataSource=Userprogram.mdb");<br />
}<br />
<br />
public DataSet SelectSQL(String stable,String sProgramName)<br />
{<br />
DataSet ds=new DataSet();<br />
objConn.Open();<br />
objCmdSelecte = new OleDbCommand("Select * From Timeway where TW_Program_Name ='" + sProgramName + "'", objConn);<br />
<br />
objAdapter.SelectCommand = objCmdSelecte;<br />
objAdapter.Fill(ds);<br />
objConn.Close();<br />
return ds;<br />
}<br />
<br />
public void UpdateSQL(DataSet ds)<br />
{<br />
objConn.Open();<br />
objAdapter.Update(ds);<br />
objConn.Close();<br />
}
formA:
sqlconn.DbConnection();<br />
ds = sqlconn.SelectSQL("PS", "Program Ni");<br />
for (int i = 0; i < 16;i++ )<br />
{<br />
ArrayData[i] = ArrayTextbox[i].Text;
ds.Tables[0].Rows[0][i + 1] = ArrayData[i];<br />
}<br />
ds.AcceptChanges();<br />
sqlconn.UpdateSQL(ds);
The problem i am facing is , nothing change to my database.I have already check the dataset which is pass to my sqlconnection class and it have been modified. So what i guess is the problem of objAdapter.update . Can anyone guide me to solve this problem?
thanks in advance
cocoon
|
|
|
|
|
Hi all,
Thank you for those who are read through my question. I have found the solution , very simple, that is add a tablemapping.add() before fill and acceptchanges() and the end when update record.
regard
cocoon
|
|
|
|
|
Hello All,
How to compare two enum types?
Thanks
|
|
|
|
|
If you need to, then you should probably use the one enum in both cases.
you have two options:
1 - cast both to int, if you can make the int values correlate ( but then just use the one enum )
2 - write a method that applies whatever comparison rules you need, by hand.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
use the typeof(ur enum) with compare() method
|
|
|
|
|
How would that work, exactly ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Good question
i have put small exmaple here
public enum Named : int
{
A,
B,
C,
D
}
public enum Names : byte
{
A,
B,
C,
D
}
check
if (Enum.Equals(typeof(Named),typeof(Names)))
{
//type is equal
}
thanks you
|
|
|
|
|
OK - so does that compare based on enum name, or their intrinsic int value ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I seen your profile,your are MVP in code project, Are you checking me?
Basically Compare based on the type of the enum
You can understand from my example.
Thank you
|
|
|
|
|
No, I've never seen this before, I would think that comparing two different enums is a bad design, I'm curious how it would work.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
So
is it wrong? or is it can't be exist like that?
|
|
|
|
|
I am saying I've never used it, I was curious how it works, although I'd never use it, personally.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
|
You're trying to compare the types to each other. The enum Equals takes two enum values.
www.wickedorange.com
www.andrewvos.com
|
|
|
|
|
*The enum Equals can take two enum values
www.wickedorange.com
www.andrewvos.com
|
|
|
|
|
Since I haven't tried this before, are there any major problems with launching an external process from a BackgroundWorker thread?
Just thought I'd ask before I try and start pulling what little hair I have left.
Thanks in advance,
Steve.
|
|
|
|
|
that is the wrong order if you ask me.
first read the documentation and/or try; if you still have a problem, then ask and
the CodeProject will try and help you.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
HI thompsons
what you means by the external process?
In my undestand, You are try start a notepad exe in same PC, is it?
is it correct ,can up external process.
|
|
|
|
|
Rule #1, try it!
No, there's no problem with doing that at all. A new process starts on it's own thread anyway, so it really doesn't matter which thread you start a new proc on.
|
|
|
|
|
To all:
Thanks for the reply.
My apologies for breaking rule #1; wasn't aware of it...
Regards,
Steve.
|
|
|
|
|
Hi, I've only taken 2 programming classes thus far so I am fairley new to it all (but I love it so far!). I made an application to take and store all my notes for all my different classes (college). The problem I am having is, I want to display a powerpoint and be able to navigate through it in either a webrowser or picturebox beside my richtextbox for my notes. Is there a simple way to do this? I've searched the web a lot and can't seam to find anything? Any help would be great! thanks
Rusty
|
|
|
|
|
You can control office through the microsoft tools for office ( or something like that ). You can't display a ppt on a machine that doesn't have powerpoint installed, but I'd expect you could perhaps do it through the libraries MS provides, on a machine that has it.
You definately cannot do it in a picturebox, if you can do it through a browser control, it's only because the browser itself knows how to open a powerpoint ( I'm not sure if it opens them embedded, like PDFs will open )
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
This is the header of my only function in my dll file and it compiles just fine
public static string SaveName(string strName)
and on the other hand in my class that implements the dll I have this:
[DllImport("MyBloodyDLL.dll", EntryPoint = "SaveName")]
public static extern string SaveName(string strName);
and when calling the SaveName("string") function later, I get this beautiful exception:
Unable to find an entry point named 'SaveName' in DLL 'MyBloodyDLL.dll
Please help
ps. I HATE DLLs!!
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
modified on Wednesday, April 16, 2008 4:49 PM
|
|
|
|
|
strName!=SaveName
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|