public partial class Sql_OracleDefault : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        OracleConnection conn = new OracleConnection("연결문자열");
        conn.Open();
        OracleCommand comm = new OracleCommand(this.TextBox1.Text, conn);
        OracleDataReader rs =   comm.ExecuteReader();
        DataTable dt =        rs.GetSchemaTable();
        this.TextBox2.Text = string.Empty;
        
            while (rs.Read() ) {
                 for (int ii = 0; ii < rs.FieldCount; ii++) {
						//rs.GetName(ii) 컬럼이름

                     this.TextBox2.Text +=  rs.GetName(ii) + ": " + rs[ii].ToString() + "\n ";
                   
                 }
                 this.TextBox2.Text += "---------------------------------------------";
                 this.TextBox2.Text += "\n";
             }
         
     

            conn.Close();
    }
}

+ Recent posts