Click here to Skip to main content
12,398,537 members (59,642 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: SQL-Server ADO.NET
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 didnt find any way to insert row in SQL database in connected mode. Please provide me a idea for inserting this row?
Posted 30-Dec-12 2:11am

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Have a look at: SqlCommand.Parameters[^] - the example shows how to perform the operations - including the use of parameters to pass values to the server.

You could also have a look at: C# Station ADO.NET Tutorial[^]

Best regards
Espen Harlinn
  Permalink  
v2
Comments
__TR__ 30-Dec-12 11:07am
   
My 5!
Espen Harlinn 31-Dec-12 7:06am
   
Thank you, TR

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160721.1 | Last Updated 30 Dec 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100