Click here to Skip to main content
15,922,630 members
Home / Discussions / C#
   

C#

 
AnswerRe: Password Permission Pin
Dave Kreskowiak7-Jun-07 4:38
mveDave Kreskowiak7-Jun-07 4:38 
GeneralRe: Password Permission Pin
Dan Neely7-Jun-07 7:31
Dan Neely7-Jun-07 7:31 
GeneralRe: Password Permission Pin
Dave Kreskowiak7-Jun-07 8:21
mveDave Kreskowiak7-Jun-07 8:21 
AnswerRe: Password Permission Pin
Rick van Woudenberg7-Jun-07 5:02
Rick van Woudenberg7-Jun-07 5:02 
AnswerRe: Password Permission Pin
Dan Neely7-Jun-07 7:29
Dan Neely7-Jun-07 7:29 
QuestionDouble seperator disappears upon insert in DB Pin
Rick van Woudenberg7-Jun-07 3:37
Rick van Woudenberg7-Jun-07 3:37 
AnswerRe: Double seperator disappears upon insert in DB Pin
Ian Shlasko7-Jun-07 4:38
Ian Shlasko7-Jun-07 4:38 
GeneralRe: Double seperator disappears upon insert in DB Pin
Rick van Woudenberg7-Jun-07 5:26
Rick van Woudenberg7-Jun-07 5:26 
Hi Ian,

Thank you even giving it a go Smile | :)
This is basically what I am doing :

private void btnRunwaySet_Click(object sender, EventArgs e)<br />
        {<br />
            <br />
          //grab some stuff from the registry as value for my query<br />
<br />
          RegistryKey key = Registry.CurrentUser.OpenSubKey("Software\\TestApp\\DBSettings", false);<br />
            if (key == null)<br />
            {<br />
                key = Registry.CurrentUser.CreateSubKey("Software\\TestApp\\DBSettings");<br />
            }<br />
            else<br />
            {<br />
                object db;<br />
                db = key.GetValue("name");<br />
                lbl.Text = db.ToString();<br />
            }<br />
            <br />
            //convert the textbox input to Double ( for insertion in DB )<br />
            <br />
            Double a = Convert.ToDouble(textbox.Text);<br />
<br />
            //Chuck it all in the database<br />
<br />
            NpgsqlConnection conn = new NpgsqlConnection("Server=" + txtDBip.Text + ";" + "Port=" + txtDBPort.Text + ";" + "User Id=" + txtDBuname.Text + ";" + "Password=" + txtDBPasswd.Text + ";" + "Database=jordan;");<br />
            conn.Open();<br />
            NpgsqlCommand command = new NpgsqlCommand("INSERT INTO (table(column)) VALUES (" + a + ") WHERE (anothercolumn) = '" + lbl.Text"'", conn);<br />
            command.ExecuteNonQuery();<br />
            conn.Close();


The column of the table is of type double precision to avoid an invalid cast exception. Now, any value given in textbox will be converted to Double and then inserted in the database. I suspect something is going wrong during the conversion from String to Double.

If I insert the Double value eg. 887.23 into the textbox, the string value 887.23 is converted to Double. The funny thing is, that when I covert it right back to string :

anothertextbox.Text = a.ToString();

or

anothertextbox.Text = Covert.ToString(a);

the values that shows up in anothertextbox is 88723. So I assume this is more of a math thing then a database error. The database is simply accepting and inserting the presented Double value.

I'm quiet puzzled actually.
GeneralRe: Double seperator disappears upon insert in DB Pin
Ian Shlasko7-Jun-07 12:01
Ian Shlasko7-Jun-07 12:01 
GeneralRe: Double seperator disappears upon insert in DB Pin
Rick van Woudenberg8-Jun-07 13:07
Rick van Woudenberg8-Jun-07 13:07 
Question[Message Deleted] Pin
Ankit Aneja7-Jun-07 3:07
Ankit Aneja7-Jun-07 3:07 
AnswerRe: Filename.indexof Pin
Sathesh Sakthivel7-Jun-07 3:12
Sathesh Sakthivel7-Jun-07 3:12 
AnswerRe: Filename.indexof Pin
Anthony Surendran7-Jun-07 3:20
Anthony Surendran7-Jun-07 3:20 
QuestionCheck Box inside a datagrid in VS2003 Pin
Anthony Surendran7-Jun-07 2:38
Anthony Surendran7-Jun-07 2:38 
AnswerRe: Check Box inside a datagrid in VS2003 Pin
SimulationofSai7-Jun-07 3:26
SimulationofSai7-Jun-07 3:26 
Question.NET C# server and VC++ client Pin
Kabirdas Jaunjare7-Jun-07 2:31
Kabirdas Jaunjare7-Jun-07 2:31 
QuestionHelp with config file error Pin
ttohme7-Jun-07 2:27
ttohme7-Jun-07 2:27 
AnswerRe: Help with config file error Pin
Sathesh Sakthivel7-Jun-07 2:33
Sathesh Sakthivel7-Jun-07 2:33 
GeneralRe: Help with config file error Pin
ttohme7-Jun-07 2:58
ttohme7-Jun-07 2:58 
GeneralRe: Help with config file error Pin
Sathesh Sakthivel7-Jun-07 3:02
Sathesh Sakthivel7-Jun-07 3:02 
GeneralRe: Help with config file error Pin
ttohme7-Jun-07 3:04
ttohme7-Jun-07 3:04 
Questionreport Pin
SVb.net7-Jun-07 2:10
SVb.net7-Jun-07 2:10 
QuestionProblem in retreiving Methods of current class using Reflection Pin
Divya Kasavar7-Jun-07 1:34
Divya Kasavar7-Jun-07 1:34 
AnswerRe: Problem in retreiving Methods of current class using Reflection Pin
Christian Graus7-Jun-07 1:50
protectorChristian Graus7-Jun-07 1:50 
AnswerRe: Problem in retreiving Methods of current class using Reflection Pin
leppie7-Jun-07 2:27
leppie7-Jun-07 2:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.