locked
VB To Oracle with combining three text boxes. Need formatting to bump valves down a line. RRS feed

  • Question

  • User-886984586 posted

    I have three (3) textboxes and I want to combine into one (1) string before I submit it to the database.  Easy, I know, but here is my issue, I want some formating before it goes in.

    <asp:TextBox ID="txtTextBox1" MaxLength="255"  runat="server" /><br />
    <asp:TextBox ID="txtTextBox2" MaxLength="255"  runat="server" /><br />
    <asp:TextBox ID="txtTextBox3" Rows="5" Wrap="true" MaxLength="2000" TextMode="MultiLine" runat="server" />
    <asp:Button Id="btnSubmit" text="Submit!" OnClick="btnSubmit_OnClick" runat="server" />
    
    <script runat="server">
    
        Protected Sub btnSubmit_OnClick(ByVal sender As Object, ByVal e As EventArgs)
            Dim strValue as String = txtTextBox3.Text
            'I need a Return Formating here
            strValue = strValue + " Value 1: " + txtTextBox1.Text
            'I need another Return Formating here
            strValue = strValue + " Value 2: " + txtTextBox2.Text
            'Then submit to Oracle DB
            Dim strSQL as String = "Insert .....
        End Sub
    
    
    </script>

    I need it to look like this before

    "txtTextBox3 is the coolest item in the world blah blah blah

    Value 1: txtTextBox1 Value

    Value 2: txtTextBox2 Value"

    Tuesday, September 27, 2011 12:37 PM

All replies

  • User269602965 posted

    try this

    Dim strValue as String = txtTextBox3.Text 
    strValue += " Value 1: " + txtTextBox1.Text 
    strValue += " Value 2: " + txtTextBox2.Text 
    Dim connectionString As String = ConfigurationManager.ConnectionStrings("{WebConfigConnStrName}").ConnectionString
    Try
      Using conn As New OracleConnection(connectionString)
      Dim SQL as string
      SQL = INSERT INTO {YOURSCHEMANAME}.{YOUTABLENAME} ({YOURCOLUMNNAME}) VALUES (:STRDATA)
    Using cmd As New OracleCommand(SQL, conn) cmd.Parameters.Clear() cmd.Parameters.Add("STRDATA", OracleDbType.Varchar2, strValue, ParameterDirection.Input) conn.Open() cmd.ExecuteNonQuery() End Using End Using Catch ex As Exception End Try
    Tuesday, September 27, 2011 7:28 PM