| | |
Deleting from database
Please support our C# advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Feb 2006
Posts: 8
Reputation:
Solved Threads: 0
Hi
I am trying to delete a name from my database however my code seems to have a problem. It seems to cut out before i actually excutes the SQL statement. Is there something else i have missed in the code. PatientNumber is equal to the value to the text.
This is reading the value for i put MessageBox in to see
I am using C# compact framework and sql ce if it makes any differences
thanks for any help
I am trying to delete a name from my database however my code seems to have a problem. It seems to cut out before i actually excutes the SQL statement. Is there something else i have missed in the code. PatientNumber is equal to the value to the text.
This is reading the value for i put MessageBox in to see
I am using C# compact framework and sql ce if it makes any differences
thanks for any help
C# Syntax (Toggle Plain Text)
SqlCeConnection connDB = new SqlCeConnection("Data Source = \\My Documents\\system.sdf"); connDB.Open(); SqlCeCommand sqlDelete = connDB.CreateCommand(); sqlDelete.CommandText = "DELETE FROM Patient WHERE (((name)= + '"PatientName"'+");)"); sqlDelete.ExecuteNonQuery(); connDB.Close();
•
•
Join Date: Jul 2005
Posts: 483
Reputation:
Solved Threads: 19
try this
C# Syntax (Toggle Plain Text)
SqlCeConnection connDB = new SqlCeConnection("Data Source = \\My Documents\\system.sdf"); connDB.Open(); SqlCeCommand sqlDelete = connDB.CreateCommand(); sqlDelete.CommandText = "DELETE FROM Patient WHERE name= '"+ PatientName+ "'"; sqlDelete.ExecuteNonQuery(); connDB.Close();
![]() |
Similar Threads
- Adding a deleting rows (JSP)
- Hijacked browser freezes (Viruses, Spyware and other Nasties)
- How to delete a particular row from a datagrid..? (VB.NET)
- Consider me please, this is not a time pass scripts!! (MS SQL)
- How to give 2 Conditions in an SQL Query (VB.NET)
- Delete from a listbox (Visual Basic 4 / 5 / 6)
Other Threads in the C# Forum
- Previous Thread: using Scripting;
- Next Thread: Error Throwing In Calculator Code When Divided By '0'
Views: 2353 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for C#
.net access ado.net algorithm array barchart bitmap box broadcast button c# chat check checkbox class client code color combobox control conversion csharp custom database datagrid datagridview dataset datetime degrees development draganddrop drawing encryption event excel file files form format forms ftp function gcd gdi+ http httpwebrequest image index input install java label list listbox listener login math mouseclick mysql networking object operator path photoshop picturebox pixelinversion post prime programming radians regex remote remoting resource saving serialization server sleep socket sql statistics stream string tcp text textbox thread time timer treeview update usercontrol validation view visualstudio webbrowser windows winforms wpf xml





