1 Replies - 1276 Views - Last Post: 15 March 2011 - 04:55 AM Rate Topic: -----

#1 shravani.dms  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 14-March 11

How to insert textbox data into web portal?

Posted 14 March 2011 - 07:55 AM

Hi This is Shravani..

I developed One windows Application which fetch data from database and insert that data into one of the portal by using Send Keys function.

The data like general information of an applicant(Id,Name,DOB,Address,City etc). And I fetch that portal on my Windows Application by Id. It Works Properly but it Slows Down my application when i run it. Now i want to upload that data through id into portal directly. I m not using portal in my windows application. I open the portal individually and only provide id in my windows application.

In Short, i want to do that when i provide id in my windows application, it direcly fetch data of that id in that portal.

Can Any body tell me to how could it possible. Below code is working properly but not working want i want.


private void RobotOnApp()
        {
            try
            {
                Status.Text = "Setting data to Fields";
                SqlConnection con = null;
                if (opRel.Checked == true)
                    con = Relcon;
                else
                    con = UNIcon;
                SqlCommand cmd = new SqlCommand("SELECT top 1 * FROM Audit_Entry WHERE Uninor_No=@MDNNo order by Id DESC", con);
                if (con.State != ConnectionState.Open)
                    con.Open();
                cmd.Parameters.Add(new SqlParameter("MDNNo", No.Text));
                SqlDataReader dReader = cmd.ExecuteReader(Commandbehavior.CloseConnection);
                if (dReader.HasRows)
                {
                    dSet = new DataSet();
                    dSet.Load((IDataReader)dReader, LoadOption.OverwriteChanges, "Bulk");
                    //if (opRel.Checked == true)
                    //    SetRelValue();
                    //else
                    //    SetUniValues();
                    //Status.Text = "All Values has been set successfully...";
                }
                else
                {
                    MessageBox.Show("No Data Found");
                    Status.Text = "No Data Found...";
                    con.Close();

                    dReader.Close();
                    dReader.Dispose();
                    cmd.Parameters.Clear();
                    cmd.Dispose();

                    return;
                }
                con.Close();

                dReader.Close();
                dReader.Dispose();
                cmd.Parameters.Clear();
                cmd.Dispose();

                SendKeys.Send("{TAB}");
                SendKeys.Send("{TAB}");
                SendKeys.Send("{TAB}");
                SendKeys.Send("{TAB}");
                SendKeys.Send("+{TAB}");
                if (dSet.Tables[0].Rows[0]["CAF_No"] != DBNull.Value)
                    SendKeys.Send(dSet.Tables[0].Rows[0]["CAF_No"].ToString().Trim());
                WaitFor();

                SendKeys.Send("{TAB}");
                SendKeys.Send(dSet.Tables[0].Rows[0]["Uninor_No"].ToString().Trim());
                WaitFor();
                SendKeys.Send("{TAB}");
                SendKeys.Send("{TAB}");
                SendKeys.Send("{TAB}");
                SendKeys.Send("{TAB}");
                SendKeys.Send(dSet.Tables[0].Rows[0]["First_Name"].ToString().Trim());
                WaitFor();
                SendKeys.Send("{TAB}");
                SendKeys.Send(dSet.Tables[0].Rows[0]["Middle_Name"].ToString().Trim());
                WaitFor();
                SendKeys.Send("{TAB}");
                SendKeys.Send(dSet.Tables[0].Rows[0]["Last_Name"].ToString().Trim());
                //  WaitFor();
                SendKeys.Send("{TAB}");
                if (dSet.Tables[0].Rows[0]["Gender"].ToString().ToLower() == "male")
                    ;//  SendKeys.Send("{DOWN}");
                else
                {
                    //SendKeys.Send("{DOWN}");
                    SendKeys.Send("{DOWN}");
                }
                SendKeys.Send("{TAB}");
                if (dSet.Tables[0].Rows[0]["DOB"] != DBNull.Value)
                {
                    DateTime dt = DateTime.Parse(dSet.Tables[0].Rows[0]["DOB"].ToString());
                    WaitFor();
                    SendKeys.Send(dt.ToString("dd/MM/yyyy").Trim());
                }
                WaitFor();
                SendKeys.Send("{TAB}");
                SendKeys.Send(dSet.Tables[0].Rows[0]["Nationality"].ToString().Trim());
                WaitFor();
                SendKeys.Send("{TAB}");
                SendKeys.Send(dSet.Tables[0].Rows[0]["First_HName"].ToString().Trim());
                WaitFor();
                SendKeys.Send("{TAB}");
                //SendKeys.Send(dSet.Tables[0].Rows[0]["FHMiddleName"].ToString().Trim());
                SendKeys.Send("{TAB}");
                SendKeys.Send(dSet.Tables[0].Rows[0]["Last_LName"].ToString().Trim());
                WaitFor();
                SendKeys.Send("{TAB}");
                SendKeys.Send(dSet.Tables[0].Rows[0]["Address_1"].ToString().Trim());
                WaitFor();
                SendKeys.Send("{TAB}");
                SendKeys.Send(dSet.Tables[0].Rows[0]["Landmark_1"].ToString().Trim());
                WaitFor();
                SendKeys.Send("{TAB}");
                SendKeys.Send(dSet.Tables[0].Rows[0]["City_1"].ToString().Trim());
                WaitFor();
                SendKeys.Send("{TAB}");
                SendKeys.Send(dSet.Tables[0].Rows[0]["PinCode_1"].ToString().Trim());
                WaitFor();
                SendKeys.Send("{TAB}");
                SendKeys.Send(dSet.Tables[0].Rows[0]["District_1"].ToString().Trim());
                WaitFor();
                SendKeys.Send("{TAB}");
                SendKeys.Send(dSet.Tables[0].Rows[0]["State_1"].ToString().Trim());
                WaitFor();
                SendKeys.Send("{TAB}");
                SendKeys.Send(dSet.Tables[0].Rows[0]["AltMob_No"].ToString().Trim());
                WaitFor();
                SendKeys.Send("{TAB}");
                SendKeys.Send("{ENTER}");
                SendKeys.Send("{TAB}");
                SendKeys.Send("{TAB}");
                SendKeys.Send(dSet.Tables[0].Rows[0]["Language"].ToString().Trim());
                WaitFor();
                SendKeys.Send("{TAB}");




Is This A Good Question/Topic? 0
  • +

Replies To: How to insert textbox data into web portal?

#2 eclipsed4utoo  Icon User is offline

  • Not Your Ordinary Programmer
  • member icon

Reputation: 1524
  • View blog
  • Posts: 5,957
  • Joined: 21-March 08

Re: How to insert textbox data into web portal?

Posted 15 March 2011 - 04:55 AM

Why don't you just analyze the POST parameters and make the request through code? Seems a lot easier than what you are trying.

http://www.dreaminco...ogrammatically/
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1