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..
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
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.
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 ") ]
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):
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.
Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.
This thread is more than three months old
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.