![]() |
| ||
| Insert,delete,Update codings in VB.NET? Hello, In .NET im using the backend as SQL Server. but when i write codings for all insert,update and delete in .NET and run the form, the error it shows like "Oledb exception was unhandled by the user" and error in SQL query. the codings are....follows.. imports systemSo these are the codings im using. for delete also the same typeim using. but im getting error, can anyone help me to solve this? |
| ||
| Re: Insert,delete,Update codings in VB.NET? Hi, I think that your command will be the problem for you..please replace "cmd=new sqlcommand("select * from emp",con)" in your code and test it whether it is working or not.. I dont get any other bug from your code.....Thanks |
| ||
| Re: Insert,delete,Update codings in VB.NET? Think it is an ASP.NET application. I made some changes, marked with XXX. On my system it works. Maybe the changes help you to get your program to work. Databaseprogramming is a wide area. Imports System |
| ||
| Re: Insert,delete,Update codings in VB.NET? Hi, First of all thanks. the Insert command is working. but if i want to insert at run time, how can i give the coding? But the delete command is not working. [ Dim sSql as String = " Delete From tablename where name = ' " & Textbox1.Text & " ' " ] [ Com = New SqlCommand(sSql,Con) ] [ Com.ExecuteNonQuery() ] [ Response.Write(" One Record Deleted ") ] Can you tell me any other coding? |
| ||
| Re: Insert,delete,Update codings in VB.NET? In most cases you would use a dataset object to keep a copy of database data inside your program, then insert, change and delete the rows in the dataset and, when done, you would use dataadapters to write the changes from the dataset to the database. But this is too much to be solved in a forum thread. There are books available, for example David Sceppa, Programming ADO.NET. For directly inserting and deleting data into a database (using a literal on the form to show feedback): Insert: Private Sub btnInsertDirect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _Delete: Private Sub btnDeleteDirect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDeleteDirect.Click |
| ||
| Re: Insert,delete,Update codings in VB.NET? Hi, In the TRY .....CATCH block, u have written some thing like... [ litMsg.text ] what is this ? is it textbox or anything?? |
| ||
| Re: Insert,delete,Update codings in VB.NET? i think its textbox |
| ||
| Re: Insert,delete,Update codings in VB.NET? litMsg is a "literal", a Server Control from the toolbox/Web Forms Tab. When you first posted the thread you wrote "And in Page_Load.." and "Response.Write" so I thought your application must be an ASP. NET application, since in a Windows Forms Application the event would be "Form... Load", and there normally is no "Resonse.Write" in a Windows Forms application. |
| All times are GMT -4. The time now is 1:12 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC