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

  • SEARCH
  • Home
  • 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 9056823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T14:18:04+00:00 2026-06-16T14:18:04+00:00

I have a database in which a table has name Registration which is used

  • 0

I have a database in which a table has name Registration which is used to register the user.

It has only two column one is Username and one is password.

A page named Register.aspx is used for registering the member which have two textbox one is for taking Username(textbox1) and one is for taking password(textbox2) and one button for insert these value in database.

The Main problem is that we cannot write statement like this :

Insert into Registration (Username, password) 
values ('TextBox1.text','TextBox2.text')

I am using ADO.net Connection oriented mode, I googled but I didn’t find any way to insert row in SQL database in connected mode. Please provide me a idea for inserting this row?

  • 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-06-16T14:18:06+00:00Added an answer on June 16, 2026 at 2:18 pm

    ADO.NET has DataReader which supports Connected mode. All else are disconnected.

    DataReader is connected architecture since it keeps conneection open untill all records are fetched

    If you want to insert in ADO.NET then you should perform the following steps:

    private void btnadd_Click(object sender, EventArgs e)
    {
      try
      {
       //create  object  of Connection Class..................
       SqlConnection con = new SqlConnection();
    
       // Set Connection String property of Connection object..................
      con.ConnectionString = "Data Source=KUSH-PC;Initial Catalog=test;Integrated           Security=True";
    
     // Open Connection..................
      con.Open();
    
     //Create object of Command Class................
     SqlCommand cmd = new SqlCommand();
    
    //set Connection Property  of  Command object.............
    cmd.Connection = con;
    //Set Command type of command object
    //1.StoredProcedure
    //2.TableDirect
    //3.Text   (By Default)
    
    cmd.CommandType = CommandType.Text;
    
    //Set Command text Property of command object.........
    
    cmd.CommandText = "Insert into Registration (Username, password) values ('@user','@pass')";
    
    //Assign values as `parameter`. It avoids `SQL Injection`
    cmd.Parameters.AddWithValue("user", TextBox1.text);
    cmd.Parameters.AddWithValue("pass", TextBox2.text);
    
     Execute command by calling following method................
      1.ExecuteNonQuery()
           This is used for insert,delete,update command...........
      2.ExecuteScalar()
           This returns a single value .........(used only for select command)
      3.ExecuteReader()
         Return one or more than one record.
    
      cmd.ExecuteNonQuery();
      con.Close();
    
    
      MessageBox.Show("Data Saved");          
      }
         catch (Exception ex)
         {
                MessageBox.Show(ex.Message);
                con.Close();
         }
    
    
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a database which has two tables. One table contains the information of
I have a database table which has a column with the name notes. This
1) I have a table tbl_Data in database which has name column with text
We have a Oracle 9i database and OrderDetails table which has a column to
I have a table in SQLite database of Android which has a column RANK
I have a MySQL database and a table which has a names column as
I have a column 'name' in Database which has values as 'john,smith'. I'm passing
Folks, I have a oracle database table which has name value pairs. A set
I have a database table which contains an ID column and a Name column.
I have a SQL Server 2005 legacy database which has a table named user

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.