Hi,
What is wrong with this one
SqlConnection con = new SqlConnection("Server=.\\SQLExpress;Database=patient;uid=sa;pwd=;");
String Query;
Query = "Delete from PatientRecords where PatientID='" + TextBox1.Text + "'";
SqlCommand sqlcmb = new SqlCommand();
con.Open();
sqlcmb.Connection = con;
SqlTransaction sqltran;
sqltran = con.BeginTransaction();
sqlcmb.Transaction = sqltran;
sqlcmb.CommandText = Query;
sqlcmb.ExecuteNonQuery();
Thanks in Advance,
A.Durga Prasad
Loading
durga prasadPosted Mar 26, 2009, 1:54 AM
SqlConnection con = new SqlConnection("Server=.\\SQLExpress;Database=patient;uid=sa;pwd=;");
String Query;
Query = "Delete from PatientRecords where PatientID='" + txtPatientID.Text + "'";
SqlCommand sqlcmb = new SqlCommand();
con.Open();
sqlcmb.Connection = con;
SqlTransaction sqltran;
sqltran = con.BeginTransaction();
sqlcmb.Transaction = sqltran;
sqlcmb.CommandText = Query;
sqlcmb.ExecuteNonQuery();
sqltran.Commit(); //Missing this line
durga prasadPosted Mar 26, 2009, 1:16 AM
data base (ex. The Values is not getting deleted from database).
Amit TiwariPosted Mar 25, 2009, 6:42 PM
Rama bandapelliPosted Mar 25, 2009, 12:13 PM
It depends on what datatype PatientId is TextBox1.text passes a string value with some empty charecters some time, use textbox1.text.Trim().
akhilPosted Mar 25, 2009, 4:50 AM
just tell what problem u are facing
then only we can help u
Is there problem in connection or not deleting record or else so pls be specific with question
akhilesh
Ryan AlfordPosted Mar 24, 2009, 1:14 PM