| | |
Data inserting problem
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
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
| Thread Tools | Search this Thread |
.net 2.0 activexcontrol ajax alltypeofvideos appliances application asp asp.net bc30451 beginner bottomasp.net box browser button c# cac checkbox commonfunctions control dataaccesslayer database datagridview datagridviewcheckbox datalist deployment development dgv dialog dropdownlist dynamic dynamically edit embeddingactivexcontrol expose feedback fileuploader fill findcontrol flash form formatdecimal formview google gridview gudi iis image javascript listbox login microsoft mobile mouse mssql news novell numerical opera panelmasterpagebuttoncontrols parent radio redirect registration relationaldatabases reportemail save schoolproject search security select sessionvariables silverlight smartcard smoobjects software sql-server sqlserver2005 ssl suse textbox tracking treeview unauthorized validatedate validation vb.net video videos view vista visualstudio web webapplications webdevelopemnt webdevelopment webprogramming webservice xsl youareanotmemberofthedebuggerusers





