>4000 characters in a TextBox

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default >4000 characters in a TextBox

    I'm having the same problem. Basically, what I need to
    know is - Can I move more than 4000 characters from a
    TextBox in a Web Form to a string? If so, some code that
    illustrates how to do this would be appreciated.

    >-----Original Message-----
    >Hi,
    >
    >I'm trying to send >4000 text data from a TextBox to a
    >clob column of an Oracle table.
    >
    >code:
    >
    >using System;
    >using System.Collections;
    >using System.ComponentModel;
    >using System.Data;
    >using System.Text;
    >using System.Threading;
    >using System.Drawing;
    >using System.Web;
    >using System.Web.SessionState;
    >using System.Web.UI;
    >using System.Web.UI.WebControls;
    >using System.Web.UI.HtmlControls;
    >using Oracle.DataAccess.Client;
    >using Oracle.DataAccess.Types;
    >
    >namespace clobdata
    >{
    > /// <summary>
    > /// Summary description for WebForm1.
    > /// </summary>
    > public class WebForm1 : System.Web.UI.Page
    > {
    > protected
    >System.Web.UI.WebControls.TextBox TextBox1;
    > protected
    >System.Web.UI.WebControls.TextBox TextBox2;
    > protected System.Web.UI.WebControls.Button
    >Button2;
    > protected System.Web.UI.WebControls.Label
    >Label1;
    > protected System.Web.UI.WebControls.Label
    >Label2;
    >
    > protected System.Web.UI.WebControls.Button
    >Button1;
    >
    > private void Page_Load(object sender,
    >System.EventArgs e)
    > {
    >
    > }
    >
    > #region Web Form Designer generated code
    > override protected void OnInit(EventArgs e)
    > {
    > //
    > // CODEGEN: This call is required
    >by the ASP.NET Web Form Designer.
    > //
    > InitializeComponent();
    > base.OnInit(e);
    > }
    >
    > /// <summary>
    > /// Required method for Designer support -
    >do not modify
    > /// the contents of this method with the
    >code editor.
    > /// </summary>
    > private void InitializeComponent()
    > {
    > this.Button1.Click += new
    >System.EventHandler(this.Button1_Click);
    > this.Button2.Click += new
    >System.EventHandler(this.Button2_Click);
    > this.Load += new
    >System.EventHandler(this.Page_Load);
    >
    > }
    > #endregion
    >
    > private void Button1_Click(object sender,
    >System.EventArgs e)
    > {
    > String s = TextBox1.Text;
    >
    > OracleConnection con = Connect
    >("User Id=scott;Password=tiger;Data Source=Oracle");
    >
    > StringBuilder blr;
    > OracleCommand cmd = new
    >OracleCommand("", con);
    >
    > blr = new StringBuilder();
    > blr.Append("DROP TABLE clobtest");
    > cmd.CommandText = blr.ToString();
    > try
    > {
    > cmd.ExecuteNonQuery();
    > }
    > catch (Exception ex)
    > {
    > //Console.WriteLine
    >("Warning: {0}", ex.Message);
    > }
    >
    > blr = new StringBuilder();
    > blr.Append("CREATE TABLE clobtest
    >(col1 NUMBER(4) PRIMARY KEY,");
    > blr.Append("clobcol CLOB, sound
    >BLOB)");
    > cmd.CommandText = blr.ToString();
    > try
    > {
    > cmd.ExecuteNonQuery();
    > }
    > catch (Exception ex)
    > {
    > Console.WriteLine("Error:
    >{0}", ex.Message);
    > }
    >
    > blr = new StringBuilder();
    > blr.Append("INSERT INTO clobtest
    >values(");
    > blr.Append("1,");
    > blr.Append("'" + s + "',");
    > blr.Append("'65667777')");
    > cmd.CommandText = blr.ToString();
    > try
    > {
    > cmd.ExecuteNonQuery();
    > }
    > catch (Exception ex)
    > {
    > Console.WriteLine("Error:
    >{0}", ex.Message);
    > }
    >
    > StringBuilder sql = new
    >StringBuilder();
    > sql.Append("create or replace
    >procedure Selectclobcol ( ");
    > sql.Append("clob_data OUT CLOB)
    >as ");
    > sql.Append("begin ");
    > sql.Append(" select clobcol into
    >clob_data from clobtest where col1 = 1; ");
    > sql.Append("end Selectclobcol;");
    > cmd.CommandText = sql.ToString();
    > try
    > {
    > cmd.ExecuteNonQuery();
    > }
    > catch (Exception ex)
    > {
    > Console.WriteLine("Error:
    >{0}", ex.Message);
    > }
    >
    > // Set the command
    > OracleCommand cmd2 = new
    >OracleCommand("", con);
    > cmd2.CommandText = "Selectclobcol";
    > cmd2.CommandType =
    >CommandType.StoredProcedure;
    >
    > // Bind the OraLob Object
    > OracleParameter param =
    >cmd2.Parameters.Add("clobdata", OracleDbType.Clob);
    > param.Direction =
    >ParameterDirection.Output;
    >
    > // Execute command
    > try
    > {
    > cmd2.ExecuteNonQuery();
    >
    > string lob_data = (string)
    >((OracleClob)(cmd2.Parameters[0].Value)).Value;
    >
    > }
    > catch (Exception ex)
    > {
    > Console.WriteLine
    >(ex.Message);
    > }
    > finally
    > {
    > // Dispose OracleCommand
    >object
    > cmd2.Dispose();
    >
    > // Close and Dispose
    >OracleConnection object
    > con.Close();
    > con.Dispose();
    > }
    > }
    > public static OracleConnection Connect
    >(string connectStr)
    > {
    > OracleConnection con = new
    >OracleConnection(connectStr);
    > try
    > {
    > con.Open();
    > }
    > catch (Exception e)
    > {
    > Console.WriteLine("Error:
    >{0}", e.Message);
    > }
    > return con;
    > }
    >
    > private void Button2_Click(object sender,
    >System.EventArgs e)
    > {
    > OracleConnection con = Connect
    >("User Id=scott;Password=tiger;Data Source=dell2");
    > OracleCommand cmd = new
    >OracleCommand("select clobcol from clobtest where col1 =
    >1");
    > //OracleCommand cmd = new
    >OracleCommand("select sound from clobtest where col1 =
    1");
    > cmd.Connection = con;
    > cmd.CommandType = CommandType.Text;
    >
    > OracleDataReader reader = null;
    > try
    > {
    > //cmd.ExecuteNonQuery();
    > // Create DataReader
    > reader = cmd.ExecuteReader
    >();
    >
    > // Read the first row
    > while(reader.Read())
    > {
    > // Set the
    >OracleClob object to the CLOB selected
    > OracleClob clob =
    >reader.GetOracleClob(0);
    >
    > //OracleBlob blob
    >= reader.GetOracleBlob(0);
    >
    > String str3 =
    >clob.Value;
    > //String str4 =
    >blob.Value.Length.ToString();
    >
    > //Label2.Text =
    >str4;
    > TextBox2.Text =
    >str3;
    > Label1.Text
    >= "Number of characters is " + str3.Length.ToString();
    > }
    >
    > }
    > catch (Exception ex)
    > {
    > Console.WriteLine
    >("Exception:" + ex.Message);
    > }
    > finally
    > {
    > cmd.Dispose();
    > con.Close();
    > con.Dispose();
    > }
    > }
    > }
    >}
    >
    >
    >bebop
    >
    >
    >.
    >
    phil Guest

  2. Similar Questions and Discussions

    1. Installing eye candy 4000
      i just purchased Eye candy 400 full edition, how do i set it up in fireworks? i saw that in the eye candy 400 effects section, choosing marble, then...
    2. eye candy 4000 serial number
      Can anyone share with me a working serial number for eye candy 4000 photoshop plug-in?
    3. Limit to 150 characters in multi-line textbox
      Can you limit the number of characters in a multi-line textbox? My tests in indicate that the MaxLength property causes client side limits only on...
    4. How to configure Inforprint 4000 under AIX
      Hi, We have IBM infoprint 4000 Model IS1 AFP printer with TCP/IP connection, our objective is to print through AIX non afp files, we have been...
    5. Logitech QuickCam 4000 Pro
      I have a Logitech QuickCam 4000 Pro which I cannot get working. Has anyone had experience with this? I have configured and built the kernel and...
  3. #2

    Default Re: >4000 characters in a TextBox

    I think you're out of luck.
    Your next best option is perhaps to create multiple textboxes, with the text
    split between them all. Each textbox should have no more than 4000
    characters.
    On the server, combine them and insert into your database table.

    --
    I hope this helps,
    Steve C. Orr, MCSD
    [url]http://Steve.Orr.net[/url]


    "bebop" <cwbp15@yahoo.com> wrote in message
    news:9b9901c34643$94280630$a401280a@phx.gbl...
    > Hi,
    >
    > I'm trying to send >4000 text data from a TextBox to a
    > clob column of an Oracle table.
    >
    > code:
    >
    > using System;
    > using System.Collections;
    > using System.ComponentModel;
    > using System.Data;
    > using System.Text;
    > using System.Threading;
    > using System.Drawing;
    > using System.Web;
    > using System.Web.SessionState;
    > using System.Web.UI;
    > using System.Web.UI.WebControls;
    > using System.Web.UI.HtmlControls;
    > using Oracle.DataAccess.Client;
    > using Oracle.DataAccess.Types;
    >
    > namespace clobdata
    > {
    > /// <summary>
    > /// Summary description for WebForm1.
    > /// </summary>
    > public class WebForm1 : System.Web.UI.Page
    > {
    > protected
    > System.Web.UI.WebControls.TextBox TextBox1;
    > protected
    > System.Web.UI.WebControls.TextBox TextBox2;
    > protected System.Web.UI.WebControls.Button
    > Button2;
    > protected System.Web.UI.WebControls.Label
    > Label1;
    > protected System.Web.UI.WebControls.Label
    > Label2;
    >
    > protected System.Web.UI.WebControls.Button
    > Button1;
    >
    > private void Page_Load(object sender,
    > System.EventArgs e)
    > {
    >
    > }
    >
    > #region Web Form Designer generated code
    > override protected void OnInit(EventArgs e)
    > {
    > //
    > // CODEGEN: This call is required
    > by the ASP.NET Web Form Designer.
    > //
    > InitializeComponent();
    > base.OnInit(e);
    > }
    >
    > /// <summary>
    > /// Required method for Designer support -
    > do not modify
    > /// the contents of this method with the
    > code editor.
    > /// </summary>
    > private void InitializeComponent()
    > {
    > this.Button1.Click += new
    > System.EventHandler(this.Button1_Click);
    > this.Button2.Click += new
    > System.EventHandler(this.Button2_Click);
    > this.Load += new
    > System.EventHandler(this.Page_Load);
    >
    > }
    > #endregion
    >
    > private void Button1_Click(object sender,
    > System.EventArgs e)
    > {
    > String s = TextBox1.Text;
    >
    > OracleConnection con = Connect
    > ("User Id=scott;Password=tiger;Data Source=Oracle");
    >
    > StringBuilder blr;
    > OracleCommand cmd = new
    > OracleCommand("", con);
    >
    > blr = new StringBuilder();
    > blr.Append("DROP TABLE clobtest");
    > cmd.CommandText = blr.ToString();
    > try
    > {
    > cmd.ExecuteNonQuery();
    > }
    > catch (Exception ex)
    > {
    > //Console.WriteLine
    > ("Warning: {0}", ex.Message);
    > }
    >
    > blr = new StringBuilder();
    > blr.Append("CREATE TABLE clobtest
    > (col1 NUMBER(4) PRIMARY KEY,");
    > blr.Append("clobcol CLOB, sound
    > BLOB)");
    > cmd.CommandText = blr.ToString();
    > try
    > {
    > cmd.ExecuteNonQuery();
    > }
    > catch (Exception ex)
    > {
    > Console.WriteLine("Error:
    > {0}", ex.Message);
    > }
    >
    > blr = new StringBuilder();
    > blr.Append("INSERT INTO clobtest
    > values(");
    > blr.Append("1,");
    > blr.Append("'" + s + "',");
    > blr.Append("'65667777')");
    > cmd.CommandText = blr.ToString();
    > try
    > {
    > cmd.ExecuteNonQuery();
    > }
    > catch (Exception ex)
    > {
    > Console.WriteLine("Error:
    > {0}", ex.Message);
    > }
    >
    > StringBuilder sql = new
    > StringBuilder();
    > sql.Append("create or replace
    > procedure Selectclobcol ( ");
    > sql.Append("clob_data OUT CLOB)
    > as ");
    > sql.Append("begin ");
    > sql.Append(" select clobcol into
    > clob_data from clobtest where col1 = 1; ");
    > sql.Append("end Selectclobcol;");
    > cmd.CommandText = sql.ToString();
    > try
    > {
    > cmd.ExecuteNonQuery();
    > }
    > catch (Exception ex)
    > {
    > Console.WriteLine("Error:
    > {0}", ex.Message);
    > }
    >
    > // Set the command
    > OracleCommand cmd2 = new
    > OracleCommand("", con);
    > cmd2.CommandText = "Selectclobcol";
    > cmd2.CommandType =
    > CommandType.StoredProcedure;
    >
    > // Bind the OraLob Object
    > OracleParameter param =
    > cmd2.Parameters.Add("clobdata", OracleDbType.Clob);
    > param.Direction =
    > ParameterDirection.Output;
    >
    > // Execute command
    > try
    > {
    > cmd2.ExecuteNonQuery();
    >
    > string lob_data = (string)
    > ((OracleClob)(cmd2.Parameters[0].Value)).Value;
    >
    > }
    > catch (Exception ex)
    > {
    > Console.WriteLine
    > (ex.Message);
    > }
    > finally
    > {
    > // Dispose OracleCommand
    > object
    > cmd2.Dispose();
    >
    > // Close and Dispose
    > OracleConnection object
    > con.Close();
    > con.Dispose();
    > }
    > }
    > public static OracleConnection Connect
    > (string connectStr)
    > {
    > OracleConnection con = new
    > OracleConnection(connectStr);
    > try
    > {
    > con.Open();
    > }
    > catch (Exception e)
    > {
    > Console.WriteLine("Error:
    > {0}", e.Message);
    > }
    > return con;
    > }
    >
    > private void Button2_Click(object sender,
    > System.EventArgs e)
    > {
    > OracleConnection con = Connect
    > ("User Id=scott;Password=tiger;Data Source=dell2");
    > OracleCommand cmd = new
    > OracleCommand("select clobcol from clobtest where col1 =
    > 1");
    > //OracleCommand cmd = new
    > OracleCommand("select sound from clobtest where col1 = 1");
    > cmd.Connection = con;
    > cmd.CommandType = CommandType.Text;
    >
    > OracleDataReader reader = null;
    > try
    > {
    > //cmd.ExecuteNonQuery();
    > // Create DataReader
    > reader = cmd.ExecuteReader
    > ();
    >
    > // Read the first row
    > while(reader.Read())
    > {
    > // Set the
    > OracleClob object to the CLOB selected
    > OracleClob clob =
    > reader.GetOracleClob(0);
    >
    > //OracleBlob blob
    > = reader.GetOracleBlob(0);
    >
    > String str3 =
    > clob.Value;
    > //String str4 =
    > blob.Value.Length.ToString();
    >
    > //Label2.Text =
    > str4;
    > TextBox2.Text =
    > str3;
    > Label1.Text
    > = "Number of characters is " + str3.Length.ToString();
    > }
    >
    > }
    > catch (Exception ex)
    > {
    > Console.WriteLine
    > ("Exception:" + ex.Message);
    > }
    > finally
    > {
    > cmd.Dispose();
    > con.Close();
    > con.Dispose();
    > }
    > }
    > }
    > }
    >
    >
    > bebop
    >
    >

    Steve C. Orr, MCSD Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139