Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 208427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:49:28+00:00 2026-05-11T17:49:28+00:00

I have information entered into a text box on an ASP.net 3.5 page. when

  • 0

I have information entered into a text box on an ASP.net 3.5 page. when i click the submit button i would like this information written to a sql server database.

Can someone please tell me what I need to do to accomplish this. The end-user should not see anything.

I am using visual web developer 2008. the event handling code is placed in a separate file using vb.

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T17:49:28+00:00Added an answer on May 11, 2026 at 5:49 pm

    There are lots of different ways to accomplish this: Dynamic Data, LinqToSQL, Typed data sets, Data Access Application Block, or another ORM. My preferred method is direct sql, which would use code something like this:

    Public Sub SaveAnswer(ByVal answer As String)
        Dim sql As String = "INSERT INTO [table1] (ans) VALUES (@Answer)"
    
        Using cn As New SqlConnection(getConnectionString()), _
              cmd As New SqlCommand(sql)
    
            cmd.Parameters.Add("@Answer", SqlDbType.VarChar, 50).Value = answer
    
            cn.Open()
            cmd.ExecuteNonQuery()
        End Using
    End Sub
    
    Private Function getConnectionString() As String
        ''//normally read from a config file for this
    
        Return "Server=(local)\SQLEXPRESS;Database=testdb;Trusted_Connection=True;"
    End Function
    

    A few things to take from this sample:

    • It properly closes the db connection, even if an exception is thrown, via the Using block
    • Parameterized query to prevent sql injection
    • getConnectionString() is private. You should abstract out your data access to a separate class or assembly, and this is one way to start enforcing that.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'd like to have an asp.net textbox that people can paste content into and
Hi I am trying to submit some information into a database using an ASP.NET
I have this jQuery code: <script type=text/javascript > $(function() { $('#add_comment').bind('submit',function() //$(input[type=submit]).click(function() { var
I have got a form into which information is entered, and a drop down
I am trying to have PHP search based on letters entered into a text
I have a PHP Script which has several text areas. What I would like
I need to send information input into a text box in one form to
In this scenario: User enters some information into a textbox User clicks a button
I am trying to have information displayed for this query: SELECT o.sub_number,o.unique_id,o.period_from,o.period_to,o.total_amt, i.paid_amt,i.dated,i.payment,i.paid_by,i.entered_date,i.paid_for_unique, j.cheque_num,j.drawn_on,j.dated
I have bio information inside a variable: $bio = 'text, text, text...'; I trim

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.