|
||||
kite dah cube guna 2 sql yg berbeza tp ader error.. mcm mana ek?
plzzz ader sesape leh tolong??? nie sql nye... <cfquery name="add_peminjam" datasource="maklumat" username="" password=""> INSERT INTO peminjam (nama, bahagian) VALUES ('#Form.nama#', '#Form.bahagian#') </cfquery> <cfquery name="add_tarikh" datasource="maklumat" username="" password=""> INSERT INTO pinjam (tarikhpinjam, tarikhjangkapulang) VALUES ('#Form.tarikhpinjam#', '#Form.tarikhjangkapulang#') </cfquery> yg nie plak error nye.. Error Occurred While Processing Request Error Diagnostic Information ODBC Error Code = 23000 (Integrity constraint violation) [Microsoft][ODBC Microsoft Access Driver] You cannot add or change a record because a related record is required in table 'peminjam'. The error occurred while processing an element with a general identifier of (CFQUERY), occupying document position (11:1) to (11:73). Date/Time: 07/25/05 15:27:15 Browser: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; (R1 1.5)) Remote Address: 127.0.0.1 HTTP Referrer: http://localhost/baru/pinjam.cfm |
|
||||
Data is not being inserted into "pinjam" - this is because of "Integrity constraint violation".
I guess nopeminjam is an autonumber field? You need to get this autonumber value and insert into pinjam.nopeminjam. That should solve the problem. |
|
|||
MMmmMMMmmmm
INSERT INTO peminjam (nama, bahagian) VALUES ('#Form.nama#', '#Form.bahagian#')
INSERT INTO pinjam (tarikhpinjam, tarikhjangkapulang) VALUES ('#Form.tarikhpinjam#', '#Form.tarikhjangkapulang#') pinjam (nopinjam,nopeminjam,nosiriinventori,tarikhpinjam, tarikhjangkapulang,tarikhpulang) peminjam(nopeminjam,nama,bahagian) Sounds like you have a foregin key relationship set up, and you are not supplying a valid record id. If you set pinjam..nopeminjam = autonumber, relationship between pinjam..nopeminjam and peminjam..nopeminjam will b revoke due to there were no matching id between pinjam.nopeminjam and peminjam.nopeminjam. For table..pinjam, set nopinjam to primarykey and autonumber, then drag the id from peminjam.nopeminjam and insert it back to your pinjam..nopeminjam (do not put pinjam.nopeminjam as autonumber). e.g. INSERT INTO peminjam (nama, bahagian) VALUES ('#Form.nama#', '#Form.bahagian#') then select @nopeminjam from peminjam order by nopeminjam desc then INSERT INTO pinjam (nopeminjam, tarikhpinjam, tarikhjangkapulang) VALUES (@nopeminjam,'#Form.tarikhpinjam#', '#Form.tarikhjangkapulang#') end |
|
||||
aiiyakk...
ok, nie semua table & atribut yg sy ader
peminjam (nopeminjam (autonumber & primary key), nama, bahagian) pinjam (nopinjam (autonumber & primary key), nopeminjam, nosiriinventori, tarikhpinjam, tarikhjangkapulang, tarikhpulang) inventori (nosiriinventori (primary key), jenis, model, kodhartamodal, harga) aksesori (nosiri (primary key), nosiriinventori, jenis, model) 1st, bley tak kite nak tau... ape fungsi "@" pd @nopeminjam tuh.. 2nd... sql yg sy wat still tak jadi... ader error <cfquery name="add_peminjam" datasource="maklumat" username="" password=""> INSERT INTO peminjam (nama, bahagian) VALUES ('#Form.nama#', '#Form.bahagian#') </cfquery> <cfquery name="add_nopeminjam" datasource="maklumat" username="" password=""> select @nopeminjam from peminjam order by nopeminjam desc </cfquery> <cfquery name="add_tarikh" datasource="maklumat" username="" password=""> INSERT INTO pinjam (nopeminjam, tarikhpinjam, tarikhjangkapulang) VALUES (@nopeminjam,'#Form.tarikhpinjam#', '#Form.tarikhjangkapulang#') </cfquery> yg nie plak errornye Error Occurred While Processing Request Error Diagnostic Information ODBC Error Code = 07001 (Wrong number of parameters) [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1. Hint: The cause of this error is usually that your query contains a reference to a field which does not exist. You should verify that the fields included in your query exist and that you have specified their names correctly. The error occurred while processing an element with a general identifier of (CFQUERY), occupying document position (11:1) to (11:77). Date/Time: 07/27/05 12:24:37 Browser: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; (R1 1.5); FDM) Remote Address: 127.0.0.1 HTTP Referrer: http://localhost/baru/pinjam.cfm |
|
|||
Dear azmaliya,
What i mean is that you need to drag the last noPeminjam from your peminjam table and put it back to your pinjam table. As for select @nopeminjam from peminjam order by nopeminjam desc, @nopeminjam is something that you need to declare and put it back into your PINJAM table. BTW, for your information @ = SQL StoredProcedure/Trigger language, which we use that to declare something, it is nothing to do with you CFM ![]() |
|
||||
hello there.... it's me again..
still tak dpt lagi lah.. tlg lah kite....kali nie kite try wat mcm nie plak.. tp tak jadi jgk.. <cfquery name="add_peminjam" datasource="maklumat" username="" password=""> INSERT INTO peminjam (nama,bahagian) VALUES ('#Form.nama#','#Form.bahagian#'); select @nopeminjam from peminjam order by nopeminjam desc </cfquery> <cfquery name="add_tarikh" datasource="maklumat" username="" password=""> INSERT INTO pinjam (nopeminjam,tarikhpinjam,tarikhjangkapulang) VALUES ('#add_peminjam.nopeminjam#','#Form.tarikhpinjam#' , '#Form.tarikhjangkapulang#') </cfquery> Error Occurred While Processing Request Error Diagnostic Information ODBC Error Code = 37000 (Syntax error or access violation) [Microsoft][ODBC Microsoft Access Driver] Characters found after end of SQL statement. The error occurred while processing an element with a general identifier of (CFQUERY), occupying document position (8:1) to (8:75). Date/Time: 07/29/05 11:53:08 Browser: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; (R1 1.5); FDM) Remote Address: 127.0.0.1 HTTP Referrer: http://localhost/baru/pinjam.cfm |
![]() |
«
Previous Thread
|
Next Thread
»
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| insert php in html | sloth | Website Programming | 7 | 26-08-2005 07:34 PM |
| checking multiple emails from multiple domain | mrbadak | Mamak Stall | 4 | 28-06-2005 08:59 PM |
| Multiple data | koisempoi | Website Programming | 5 | 06-12-2004 10:51 AM |
| insert multiple data | vash | Website Programming | 4 | 28-04-2004 02:48 PM |














still tak dpt lagi lah.. tlg lah kite....
Linear Mode

