Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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 :

SQL
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

1 solution

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
 
Share this answer
 
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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900