Click here to Skip to main content
15,880,796 members
Home / Discussions / Database
   

Database

 
GeneralRe: About SQL Pin
Colin Angus Mackay19-Feb-07 23:56
Colin Angus Mackay19-Feb-07 23:56 
Questionupdate/delete error "Could not determine which columns uniquely identify the rows for" Pin
roithi19-Feb-07 18:24
roithi19-Feb-07 18:24 
AnswerRe: update/delete error "Could not determine which columns uniquely identify the rows for" Pin
andyharman20-Feb-07 0:10
professionalandyharman20-Feb-07 0:10 
QuestionHelp Me:Can we select sum of 2 columns in one select statement? Pin
priya_p23319-Feb-07 17:41
priya_p23319-Feb-07 17:41 
AnswerRe: Help Me:Can we select sum of 2 columns in one select statement? Pin
K.P.Kannan19-Feb-07 18:26
K.P.Kannan19-Feb-07 18:26 
AnswerRe: Help Me:Can we select sum of 2 columns in one select statement? Pin
asithangae19-Feb-07 18:30
asithangae19-Feb-07 18:30 
GeneralRe: Help Me:Can we select sum of 2 columns in one select statement? Pin
asithangae19-Feb-07 18:42
asithangae19-Feb-07 18:42 
Questionparent and child deleting using typed datasets, cascade to delete children Pin
steve_rm19-Feb-07 17:06
steve_rm19-Feb-07 17:06 
Hello

VS 2005

I have a parent and child table.

I am trying to delete the parent which will also delete all the corresponding children in the child table.

I am using the typed dataset and have created the schema in the .xsd. I have not created the relationship between the table in the .xsd as I find sometimes I have problem updating as there is always some constraint problem. So I normally create the relationship in code when I need to. I think i will have to cascade down.

this is my code for deleting.

<br />
Try<br />
                    'Get the AssemblyID number of the assembly that will be deleted<br />
                    drv = DirectCast(Me.cboAssemblies.SelectedItem, DataRowView)<br />
                    AssemblyID = drv("AssemblyID")<br />
<br />
                    'Create the parent/child relationship<br />
                    Me.DsAssembly.Relations.Add("relAssembly", Me.DsAssembly._Assembly.AssemblyIDColumn, Me.DsAssembly.AssembliedEquipment.AssemblyIDColumn)<br />
<br />
                    'Get the row of data for the assembly that will be deleted<br />
                    datarow = Me.DsAssembly._Assembly.FindByAssemblyID(AssemblyID)<br />
<br />
                    'Delete this row<br />
                    rowsAffected = Me.TA_Assembly_DsAssembly1.Delete(datarow.AssemblyID, datarow.AssemblyName)<br />
<br />
                    If (rowsAffected = 1) Then<br />
                        MessageBox.Show("Assemblied part has been deleted", "Delete Assembly", MessageBoxButtons.OK, MessageBoxIcon.Information)<br />
                    Else<br />
                        MessageBox.Show("Assemblied part cannot be deleted", "Delete Assembly", MessageBoxButtons.OK, MessageBoxIcon.Error)<br />
                    End If<br />
<br />
                Catch ex As Exception<br />
                    MessageBox.Show(ex.Message)<br />
                End Try<br />



It deletes the parent but does cascade down to delete all the children that belong to this parent.

Is there something I can do to improve this.

Many thanks,

Steve
QuestionRe: parent and child deleting using typed datasets, cascade to delete children Pin
steve_rm19-Feb-07 19:41
steve_rm19-Feb-07 19:41 
QuestionMulti-Column Contains Syntax??? Pin
code-frog19-Feb-07 12:50
professionalcode-frog19-Feb-07 12:50 
AnswerRe: Multi-Column Contains Syntax??? Pin
Krish - KP19-Feb-07 23:38
Krish - KP19-Feb-07 23:38 
GeneralRe: Multi-Column Contains Syntax??? Pin
code-frog20-Feb-07 8:19
professionalcode-frog20-Feb-07 8:19 
QuestionADO.NET book that uses practical application examples Pin
reach4thelasers19-Feb-07 11:18
reach4thelasers19-Feb-07 11:18 
AnswerRe: ADO.NET book that uses practical application examples Pin
firestoper19-Feb-07 12:56
firestoper19-Feb-07 12:56 
AnswerRe: ADO.NET book that uses practical application examples Pin
Rahithi23-Feb-07 2:30
Rahithi23-Feb-07 2:30 
GeneralRe: ADO.NET book that uses practical application examples Pin
reach4thelasers3-Mar-07 12:01
reach4thelasers3-Mar-07 12:01 
Questiondeference between tow types of join Pin
a_yosef19-Feb-07 11:13
a_yosef19-Feb-07 11:13 
AnswerRe: deference between tow types of join Pin
Christian Graus19-Feb-07 11:21
protectorChristian Graus19-Feb-07 11:21 
GeneralRe: deference between tow types of join Pin
a_yosef19-Feb-07 12:15
a_yosef19-Feb-07 12:15 
QuestionWhich DataType? Pin
Sam Heller19-Feb-07 6:16
Sam Heller19-Feb-07 6:16 
AnswerRe: Which DataType? Pin
andyharman19-Feb-07 7:00
professionalandyharman19-Feb-07 7:00 
GeneralRe: Which DataType? Pin
Marcus J. Smith19-Feb-07 8:14
professionalMarcus J. Smith19-Feb-07 8:14 
QuestionBLOB - Document System Pin
alwinSCH19-Feb-07 5:07
alwinSCH19-Feb-07 5:07 
AnswerRe: BLOB - Document System Pin
andyharman19-Feb-07 5:34
professionalandyharman19-Feb-07 5:34 
QuestionCopy Stored Procedure Pin
Gjuviqta19-Feb-07 3:15
Gjuviqta19-Feb-07 3:15 

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.