Click here to Skip to main content
11,478,066 members (68,408 online)
Rate this: bad
good
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 3: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__ at 30-Dec-12 11:07am
   
My 5!
Espen Harlinn at 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
0 Frankie-C 160
1 Sergey Alexandrovich Kryukov 149
2 Sascha Lefèvre 145
3 F-ES Sitecore 130
4 siddartha kopparapu 103
0 Sergey Alexandrovich Kryukov 7,675
1 OriginalGriff 7,321
2 Sascha Lefèvre 3,034
3 Maciej Los 2,491
4 Richard Deeming 2,325


Advertise | Privacy | Mobile
Web02 | 2.8.150520.1 | Last Updated 30 Dec 2012
Copyright © CodeProject, 1999-2015
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