Click here to Skip to main content
15,893,588 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi
i have developed a web application,having a web form DataTransaction.aspx
when i run this by setting "run as start up" in browser am observing

localhost:3038/DataTransaction.aspx----->upto this fine.

but i want to trace (by keeping break points) with url:
localhost:3038/DataTransaction.aspx?MID=mach1&&CNUM=c1&AMT=1000&TOT=01022014112233&UPWD=op1&TT=1


here is my form code behind code:
C#
<pre lang="c#">using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MySql.Data.MySqlClient;
using System.Web.Configuration;

namespace Online_Billing_System
{
    public partial class DataTransaction : System.Web.UI.Page
    {
        String ConnectionString = WebConfigurationManager.ConnectionStrings["myConnectionString"].ToString();


        bool found = false;
        String memberid, name, phonenumber;
        decimal openbal, due;


        protected void Page_Load(object sender, EventArgs e)
        {
            String machineid = Request.QueryString["MID"];
            String cardid = Request.QueryString["CNUM"];
            decimal paidamount = Convert.ToDecimal(Request.QueryString["AMT"]);
            String paiddate = Request.QueryString["TOT"];
            String operatorid = Request.QueryString["UPWD"];


            if (machineid != null && cardid != null && paidamount != 0 && paiddate != null && operatorid != null)
            {
                if (Convert.ToInt32(Request.QueryString["TT"]) == 1)
                {
                    using (MySqlConnection con = new MySqlConnection(ConnectionString))
                    {
                        // whether operator id exist or not

                        String browseroperatorid = Request.QueryString["UPWD"].ToString();
                        String query = "select operator_id from operator";
                        MySqlCommand command = new MySqlCommand(query, con);
                        con.Open();
                        using (MySqlDataReader rdr = command.ExecuteReader())
                        { 
                            
                           while(rdr.Read())
                            {
                            String dboperatorid = rdr["operator_id"].ToString();

                            if (dboperatorid.Equals(browseroperatorid))
                            {
                                found = true;
                                break;

                            }

                        }
                        }

                        if (found == true)
                        {
                            // get the details from admin based on card id if operator id exist

                            String selectquery = "select * from admin where card_id= '" + cardid + "'";
                            MySqlCommand command1 = new MySqlCommand(selectquery, con);
                            using (MySqlDataReader rdr = command1.ExecuteReader())
                            {
                                if (rdr.Read())
                                {
                                    memberid = rdr["member_id"].ToString();
                                    name = rdr["name"].ToString();
                                    phonenumber = rdr["phone_number"].ToString();
                                    openbal = Convert.ToDecimal(rdr["opening_balance"].ToString());
                                    due = openbal - paidamount;
                                }
                                // card id does not exist
                                else
                                    Response.Write("$TS=2#");
                            }
                            // insert new record into trasaction


                            String insertquery = "insert into transaction(machine_id,operator_id,member_id,card_id,name,paid_amount,due_amount,paid_date,phone_number) values(@machineid,@operatorid,@memberid,@cardid,@name,@paidamount,@dueamount,@paiddate,@phone) ";
                            MySqlCommand command2 = new MySqlCommand(insertquery, con);
                            command2.Parameters.AddWithValue("@machineid", machineid);
                            command2.Parameters.AddWithValue("@operatorid", operatorid);
                            command2.Parameters.AddWithValue("@memberid", memberid);
                            command2.Parameters.AddWithValue("@cardid", cardid);
                            command2.Parameters.AddWithValue("@name", name);
                            command2.Parameters.AddWithValue("@paidamount", paidamount);
                            command2.Parameters.AddWithValue("@dueamount", due);
                            
                            if (paiddate.Length == 14)
                            {
                                string format = "ddMMyyyyHmmss";

                                DateTime dateTime = DateTime.ParseExact(paiddate, format,
                                    System.Globalization.CultureInfo.InvariantCulture);

                                String result = dateTime.ToString("yyyy-MM-dd H:mm:ss");
                                command2.Parameters.AddWithValue("@paiddate", result);

                            }
                            else//if date does not contain 14 digits,Invalid Transaction.
                            {
                                Response.Write("$TS=2#");
                            }
                                command2.Parameters.AddWithValue("@phone", phonenumber);
                            command2.ExecuteNonQuery();

                            Response.Write("$AMT='" + paidamount + "'|BAL='" + due + "'|TS=1# ");


                            //update admin with due amount
                            String updatequery = "update admin set opening_balance='" + due + "' where card_id='" + cardid + "' ";
                            MySqlCommand command3 = new MySqlCommand(updatequery, con);
                            command3.ExecuteNonQuery();
                        }
                        // invalid operator id
                        else
                            Response.Write("$TS=3#");
                    }
                }
                else
                    if (Convert.ToInt32(Request.QueryString["TT"]) == 2)
                    {
                        using (MySqlConnection con = new MySqlConnection(ConnectionString))
                        {
                            String browseroperatorid = Request.QueryString["UPWD"].ToString();
                            String query = "select operator_id from operator";
                            MySqlCommand command = new MySqlCommand(query, con);
                            con.Open();
                            using (MySqlDataReader rdr = command.ExecuteReader())
                            {

                                while (rdr.Read())
                                {
                                    String dboperatorid = rdr["operator_id"].ToString();

                                    if (dboperatorid.Equals(browseroperatorid))
                                    {
                                        found = true;
                                        break;

                                    }

                                }
                            }
                            if (found == true)
                            {

                                String query1 = "select opening_balance from admin where card_id='" + cardid + "' ";
                                MySqlCommand command1 = new MySqlCommand(query1, con);
                                using (MySqlDataReader rdr = command.ExecuteReader())
                                {
                                    if (rdr.Read())
                                    {
                                        String bal = rdr["opening_balance"].ToString();
                                        Response.Write("$ BAL='" + bal + "'|TS=1#   ");

                                    }
                                    else// card id does not exist
                                        Response.Write("$ TS=2# ");
                                }

                            }
                            else//operator id does not exist
                                Response.Write("$TS=3#");
                        }


                    }
                    else
                        if (Convert.ToInt32(Request.QueryString["TT"]) == 3)
                        {

                            using (MySqlConnection con = new MySqlConnection(ConnectionString))
                            {
                                String browseroperatorid = Request.QueryString["UPWD"].ToString();
                                String query = "select operator_id from operator";
                                MySqlCommand command = new MySqlCommand(query, con);
                                con.Open();
                                using (MySqlDataReader rdr = command.ExecuteReader())
                                {

                                    while (rdr.Read())
                                    {
                                        String dboperatorid = rdr["operator_id"].ToString();

                                        if (dboperatorid.Equals(browseroperatorid))
                                        {
                                            found = true;
                                            break;

                                        }

                                    }
                                }
                                if (found == true)
                                { 
                                
                                
                                
                                
                                
                                }

                            }
                        
                        }
            //invalid transaction
            }
            else
                Response.Write("$TS=2#");
            
        }
    }
}



How to check it.
Posted

To debug JavaScript, you can use browser developer support.
For IE 9 and above, press F12.
For firefox, install Firebug.

These dev tools will help you debug.
 
Share this answer
 
 
Share this answer
 
v2
Comments
Member 10263519 3-Feb-14 0:39am    
i know , just by clicking debug , for a form.but i want to type url with parameters , when i hit enter then web form needs to be traced how is it possible......

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900