These 3 tables are the ones that I'm dealing with that have relationships...
I checked all of the constraints and there are none and I checked all of the "enforce foreign key restraints" for all of the relationships and they are all set to "No"
Customers table
CustomerID - Identity
various_other_fields
TherapistID
With these Relationships
FK_Customers_Therapists
Primary key table - Therapists (Field - TherapistID)
Foreign key table - Customers (Field - TherapistID)
FK_Tickets_Customers
Primary key table - Customers (Field - CustomerID)
Foreign key table - Tickets (Field - CustomerID)
***************************************
Therapist table
TherapistID - Identity
various_other_fields
With these Relationships
FK_Customers_Therapists
Primary key table - Therapists (Field - TherapistID)
Foreign key table - Customers (Field - TherapistID)
FK_Tickets_Therapists
Primary key table - Therapists (Field - TherapistID)
Foreign key table - Tickets (Field - TherapistID)
***************************************
Tickets table
TicketID - Identity
various_other_fields
TherapistID
CustomerID
With these Relationships
FK_Tickets_Customers
Primary key table - Customers (Field - CustomerID)
Foreign key table - Tickets (Field - CustomerID)
FK_Tickets_Therapists
Primary key table - Therapists (Field - TherapistID)
Foreign key table - Tickets (Field - TherapistID)
Here is the Stored Procedure that I am using...
ALTER Procedure dbo.DeleteCustomer ( @CustomerID int ) As Set NoCount On; Delete From Tickets Where (CustomerID = @CustomerID); Delete From Customers Where (CustomerID = @CustomerID);
Here is the procedure that I am using...
string sSQL = "DeleteCustomer";
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
SqlCommand cmd = new SqlCommand();
cmd.Parameters.Clear();
cmd.CommandText = sSQL;
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@CustomerID", Session["CID"].ToString());
cmd.Connection = conn;
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
GridView1.DataBind();
Can anyone tell me what I am doing wrong?

New Topic/Question
Reply



MultiQuote




|