| | |
Data inserting problem
Please support our ASP.NET advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jun 2008
Posts: 38
Reputation:
Solved Threads: 0
Hi ,
In the Insert button i have used the follwing coding,
Textbox 1 has String and Textbox 2 has Numeric data.
Connection string "con" declared Globally.
By executing the code i got error like, "OleDb Exception was UnHandled by the user code"
" Line 1: Incorrect syntax Error "
After that i changed the code,
Like wise for Op2 also.
So by executing the above code, there is no error but same data's are inserted again and again, like if the textbox1 = preethi, textbox2 = 2001 are the data alredy present. then if i
clear those data by the "ADDNEW button" and if i insert new data , the new data are not stored, again that preethi and 2001 are stored.
i donno what will be the mistake..........!
In the Insert button i have used the follwing coding,
asp.net Syntax (Toggle Plain Text)
cmd = New OleDb.OleDbCommand("insert into emp values( ' " & TextBox1.Text & " ' , " & TextBox2.Text & "
asp.net Syntax (Toggle Plain Text)
con.Open() cmd.ExecuteNonQuery
Connection string "con" declared Globally.
By executing the code i got error like, "OleDb Exception was UnHandled by the user code"
" Line 1: Incorrect syntax Error "
After that i changed the code,
asp Syntax (Toggle Plain Text)
Dim Ssql as String = "insert into emp(nam,regno)values(@nam,@regno)" cmd = New SqlCommand(Ssql,con) Dim Op1,Op2 as SqlParameter Op1 = cmd.Parameter("@nam",SqlDbType.Char)) Op2 = cmd.Parameter("@regno",SqlDbType.Char)) Op1.Direction = ParameterDirection.Input
asp.net Syntax (Toggle Plain Text)
Op1.Value = TextBox1.Text Op2.Value = Textbox2.Text cmd.ExecuteNonQuery
So by executing the above code, there is no error but same data's are inserted again and again, like if the textbox1 = preethi, textbox2 = 2001 are the data alredy present. then if i
clear those data by the "ADDNEW button" and if i insert new data , the new data are not stored, again that preethi and 2001 are stored.
i donno what will be the mistake..........!
Last edited by peter_budo; Jul 20th, 2008 at 11:08 am. Reason: Corecting tags, [code=asp.net]YOUR CODE HERE[/code]
![]() |
Similar Threads
- How to insert data into database? (JSP)
- Reading Japanese data (Visual Basic 4 / 5 / 6)
- NEWBIE - Insert data from ASP.Net application into mutiple SQL tables (ASP.NET)
- how to insert data into the database in vb.net using textfields. (VB.NET)
- Unable to insert data into SQL Database (ASP)
- Beginner with C++ and goofy run time problem with DBL Linked List (C++)
- searching and inserting node in a binary search tree (C)
- inserting an element into an array in c language (C)
Other Threads in the ASP.NET Forum
- Previous Thread: Batch print barcode in ASP.NET, C#, on client side
- Next Thread: store files in database
Views: 561 | Replies: 0
| Thread Tools | Search this Thread |
Tag cloud for ASP.NET
.net 2.0 3.5 activexcontrol advice ajax application asp asp.net bc30451 bottomasp.net browser businesslogiclayer button c# c#gridviewcolumn chat checkbox child class click compatible confirmationcodegeneration content contenttype countryselector courier css database datagrid datagridview datagridviewcheckbox datalist deadlock development dgv dropdown dropdownmenu edit feedback flash flv folder form forms google grid gridview homeedition hosting identity iframe iis index javascript jquery list menu mono mssql multistepregistration nameisnotdeclared object objects order problem profile ratings refer rotatepage save search security serializesmo.table session silverlight smartcard software sql suse textbox tracking typeof unauthorized update validation vb vb.net video view virtualdirectory vista visual-studio visualstudio vs2008 web webarchitecture webdevelopemnt wizard xml





