Click here to Skip to main content
15,913,486 members
Home / Discussions / Database
   

Database

 
GeneralRe: datetime Comparision Pin
Rob Graham7-May-06 11:09
Rob Graham7-May-06 11:09 
GeneralRe: datetime Comparision Pin
DotNetDominator7-May-06 11:24
DotNetDominator7-May-06 11:24 
GeneralRe: datetime Comparision Pin
Rob Graham7-May-06 12:40
Rob Graham7-May-06 12:40 
GeneralRe: datetime Comparision Pin
DotNetDominator7-May-06 15:40
DotNetDominator7-May-06 15:40 
GeneralRe: datetime Comparision Pin
Rob Graham7-May-06 15:56
Rob Graham7-May-06 15:56 
QuestionSQL database batch files Pin
abdelhameed816-May-06 9:43
abdelhameed816-May-06 9:43 
AnswerRe: SQL database batch files Pin
Rob Graham7-May-06 5:36
Rob Graham7-May-06 5:36 
QuestionDeleting from an SQL database Pin
alee15.10.886-May-06 1:52
alee15.10.886-May-06 1:52 
Hi all,

I am doing a program with c# in which I am connecting it to an SQL database.
I have a button (called btnDelete) in which in it I have the following code:-

string query = ("DELETE FROM tblUsers WHERE User_name = ("+ txtDelete.Text +")");

SqlCommand myCommand = new SqlCommand();
myCommand.CommandText = query;
myCommand.Connection = myConnection;
myCommand.ExecuteNonQuery();

//Calling a method to update the database
UpdateDataIntoDatabase();

MessageBox.Show( "Deleted." );


When I run the program and click the delete button the following error occurs pointing in the myCommand.ExecuteNonQuery() part:-

An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in system.data.dll
Additional information: System error.


Can some one please tell me what do I have because I can't see anything wrong!

Thanks a lot guys
AnswerRe: Deleting from an SQL database Pin
DotNetDominator7-May-06 2:02
DotNetDominator7-May-06 2:02 
GeneralRe: Deleting from an SQL database Pin
alee15.10.887-May-06 20:12
alee15.10.887-May-06 20:12 
AnswerRe: Deleting from an SQL database Pin
Rob Graham7-May-06 4:06
Rob Graham7-May-06 4:06 
QuestionSQL2005 Express reporting services remote user Pin
juszuf5-May-06 20:37
juszuf5-May-06 20:37 
QuestionUsing ROUND Pin
myNameIsRon5-May-06 19:03
myNameIsRon5-May-06 19:03 
AnswerRe: Using ROUND Pin
Rob Graham7-May-06 5:52
Rob Graham7-May-06 5:52 
GeneralRe: Using ROUND Pin
myNameIsRon7-May-06 11:16
myNameIsRon7-May-06 11:16 
GeneralRe: Using ROUND Pin
Rob Graham7-May-06 12:30
Rob Graham7-May-06 12:30 
GeneralRe: Using ROUND Pin
myNameIsRon7-May-06 19:19
myNameIsRon7-May-06 19:19 
GeneralRe: Using ROUND Pin
Rob Graham8-May-06 8:49
Rob Graham8-May-06 8:49 
GeneralRe: Using ROUND Pin
myNameIsRon8-May-06 12:28
myNameIsRon8-May-06 12:28 
GeneralRe: Using ROUND Pin
Rob Graham8-May-06 16:48
Rob Graham8-May-06 16:48 
GeneralRe: Using ROUND Pin
myNameIsRon8-May-06 21:34
myNameIsRon8-May-06 21:34 
QuestionReporting Service 2005 Pin
devvvy5-May-06 14:38
devvvy5-May-06 14:38 
QuestionExport a table to a CSV file Pin
Alvin Ortiz5-May-06 12:46
Alvin Ortiz5-May-06 12:46 
AnswerRe: Export a table to a CSV file Pin
Rob Graham7-May-06 6:07
Rob Graham7-May-06 6:07 
GeneralRe: Export a table to a CSV file Pin
Alvin Ortiz15-May-06 12:27
Alvin Ortiz15-May-06 12:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.