M-RaH
Active member
Hi folks ...
Can someone help me with this one ???
i want to write some data 2 the DB .... in the first INSERT ...
for the 2nd INSERT i need the ClientID generated by the DB when I INSERTED the first QUERY
So i made a SELECT query to get the ClientID ( thats's probably not the wright way, but i was just trying ... )
Then the 2nd Query wants to insert the data ...
But I get a error ... with the ClientID
" 1Syntax error converting the varchar value 'ClientID' to a column of data type int."
Can onyone tell how to do this right ???
thanx
Can someone help me with this one ???
VB.NET:
[SIZE=2][COLOR=#008000]
'Insert in Tabel Clienten
[/COLOR][/SIZE][SIZE=2]myDatabase.setQuery("INSERT INTO Clienten (Naam,Voornaam,Tussenvoegsel,Voorletter,Geslacht,Geboortejaar," & _
"Straatnaam,Huisnummer,Toevoegsel,Postcode,Woonplaats)" & _
"VALUES('" & TxtBoxNaam1.Text & "','" & TxtBoxVoornaam1.Text & "','" & TxtBoxTussenvoegsel1.Text & "','" & TxtBoxVoorletters1.Text & "'" & _
"'" & CmbBoxGeslacht1.Text & "','" & CmbBoxGeboortejaar.Text & "','" & TxtBoxStraat.Text & "','" & TxtBoxHuisnummer1.Text & "'" & _
"'" & TxtBoxToevoegsel1.Text & "','" & TxtBoxPostcode1.Text & "','" & TxtBoxWoonplaats1.Text & "')")
[/SIZE][SIZE=2][COLOR=#008000]'Select ClientID vanuit Clienten Get clientID from DB
[/COLOR][/SIZE][SIZE=2][COLOR=red]myDatabase.setQuery("SELECT ClientID From Clienten WHERE Naam = '" & TxtBoxNaam1.Text & "'")[/COLOR]
[/SIZE][SIZE=2][COLOR=#008000]'Insert in Tabel Criteria [/COLOR][/SIZE][SIZE=2]myDatabase.setQuery("INSERT INTO Criteria (ClientID, Geslacht, [Leeftijd Min], [Leeftijd Max], Woonplaats)" & _
"Values ('[COLOR=red]ClientID[/COLOR]','" & CmbBoxGeslacht2.Text & "','" & CmbBoxMinLeeftijd.Text & "','" & CmbBoxMaxLeeftijd.Text & "','" & TxtBoxWoonplaats2.Text & "')")
[/SIZE][SIZE=2][COLOR=#008000]'WRITE/UPDATE/DELETE DATA and EXECUTE STDP
[/COLOR][/SIZE][SIZE=2]myDatabase.executeQuery()
[/SIZE]
i want to write some data 2 the DB .... in the first INSERT ...
for the 2nd INSERT i need the ClientID generated by the DB when I INSERTED the first QUERY
So i made a SELECT query to get the ClientID ( thats's probably not the wright way, but i was just trying ... )
Then the 2nd Query wants to insert the data ...
But I get a error ... with the ClientID
" 1Syntax error converting the varchar value 'ClientID' to a column of data type int."
Can onyone tell how to do this right ???
thanx