Guest User

Untitled

a guest
Mar 13th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.UI;
  6. using System.Web.UI.WebControls;
  7. using System.Data;
  8. using System.Data.OracleClient;
  9.  
  10.  
  11. public partial class _Default : System.Web.UI.Page
  12. {
  13. protected void Page_Load(object sender, EventArgs e)
  14. {
  15.  
  16. }
  17.  
  18. protected void Button1_Click(object sender, EventArgs e)
  19. {
  20. String mycon = "DATA SOURCE=mydatasource/example;USER
  21. ID=user;Password=mypassword;Unicode=True";
  22. String myquery = "Select * From DF_FORM_COMP_VALUE Where VALUE_STR =" +
  23. TextBox1.Text;
  24. OracleConnection con = new OracleConnection(mycon);
  25. OracleCommand cmd = new OracleCommand();
  26. cmd.CommandText = myquery;
  27. cmd.Connection = con;
  28. OracleDataAdapter da = new OracleDataAdapter();
  29. da.SelectCommand = cmd;
  30. DataSet ds = new DataSet();
  31. da.Fill(ds);
  32. if (ds.Tables[0].Rows.Count > 0)
  33. {
  34. Label1.Text = "Particular ID found successfully";
  35. Label2.Text = ds.Tables[0].Rows[0]["ID_TRANSACTION"].ToString();
  36. Label3.Text = ds.Tables[0].Rows[0]["ID_FORM_COMPONENT"].ToString();
  37. Label4.Text = ds.Tables[0].Rows[0]["ID"].ToString();
  38. }
  39.  
  40. else
  41. {
  42. Label1.Text = "ID Not Found - Please Serach Again";
  43. Label2.Text = "";
  44. Label3.Text = "";
  45. Label4.Text = "";
  46. }
  47. con.Close();
  48. }
  49.  
  50. protected void TextBox1_TextChanged(object sender, EventArgs e)
  51. {
  52.  
  53. }
  54. }
Add Comment
Please, Sign In to add comment