Assume i have a table
field1, field2, field3
and i have radio button list that displaying field1, field2, field3

If the end-user selected field2 and inserting a value into field2
How can i do? Any Tricks?
Thanks for in advance.

Well done on self-answering, but would you care to share your solution incase another user runs into the same issue?

Michael

        protected void AddTransaction(object sender, EventArgs e)
        {
            double amount = Convert.ToDouble(txtAmount.Text) + isContainValue();

            SqlConnection conAddTransaction = new SqlConnection(ConfigurationManager.ConnectionStrings["connMSJ"].ConnectionString);
            SqlCommand cmdUpdateTransaction = new SqlCommand(String.Format("UPDATE DailyBudget SET {0}=@amount WHERE (Username=@username AND Date=@date)", radCategory.SelectedValue), conAddTransaction);
            SqlCommand cmdAddTransaction = new SqlCommand(String.Format("INSERT INTO DailyBudget (Username, Date, {0}) VALUES (@username, @date, @amount)", radCategory.SelectedValue), conAddTransaction);
            cmdUpdateTransaction.Parameters.AddWithValue("@username", Master.getUsername);
            cmdUpdateTransaction.Parameters.AddWithValue("@date", DateTime.Now.Date);
            cmdUpdateTransaction.Parameters.AddWithValue("@amount", amount);

            cmdAddTransaction.Parameters.AddWithValue("@username", Master.getUsername);
            cmdAddTransaction.Parameters.AddWithValue("@date", DateTime.Now.Date);
            cmdAddTransaction.Parameters.AddWithValue("@amount", amount);
            conAddTransaction.Open();
            if (totalUsage != 0)
                cmdUpdateTransaction.ExecuteNonQuery();
            else
                cmdAddTransaction.ExecuteNonQuery();
            conAddTransaction.Close();

            totalUsage += Convert.ToDouble(txtAmount.Text);
            updateCurrentBudget(getRemainBudget(Convert.ToDouble(txtAmount.Text)));
            Response.Redirect("~/Member/Home.aspx");
        }

Sorry for that. Happy Coding Folks

Cheers Gahhon!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.