|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
hi,
Actually i'm new in this programming. I have a problem with my script. I don't have any idea how to solve it. i have 2 table (table maklumatpembeli and table bank) i want to insert data from table bank to table maklumatpembeli based on range date and id here is my script: <% Dim conn Dim rs Dim MYSQL,MYSQL2 Set conn = Server.CreateObject("ADODB.Connection") Set rs = Server.CreateObject("ADODB.Recordset") Set cmd = Server.CreateObject("ADODB.Recordset") conn.ConnectionString = "DSN=prmm;UID=administrator;" conn.Open startdate=request("tarikh1") enddate=request("tarikh2") MYSQL = "SELECT * FROM bank where paymentdate between '" & startdate & "' and '" & enddate & "'" rs.open MYSQL,conn if rs.EOF then response.Write("no data") else if ([bank.id] = [maklumatpembeli.id]) then MYSQL2 = "INSERT INTO maklumatpembeli (paymentdate, status, no_resit) values ('" & rs ("paymentdate") & "', '" & rs ("status") & "', '" & rs ("no_resit") & "')" Set rs = conn.Execute(MYSQL2) response.write "<p>" & "<center>" & "The transaction have been done" & "</center>" & "</p>" response.write "<p>" & "<A HREF=javascript:history.go(-1)>" & "GoBack" & "</a>" else response.write "No Transaction" response.write "<p>" & "<A HREF=javascript:history.go(-1)>" & "GoBack" & "</a>" end if end if Set rs = Nothing Set conn = Nothing %> the error message i get like below: Microsoft OLE DB Provider for ODBC Drivers (0x80040E14) [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot insert the value NULL into column 'id', table 'rumahmampumilik.dbo.maklumatpembeli'; column does not allow nulls. INSERT fails. /bank.asp, line 40 i don't understand! i don't want to insert the id only a few fields in table bank to table maklumatpembeli. can someone pls help me what wrong with my program? |
|
#2
|
|||
|
|||
|
This is a SQL problem and not ASP.
Your database had column ID set up as "Not allow Nulls". You cannot start a new row unless you specify a value for that field, you'll have to reachitect the DB if you're bent on not using a value in ID. But that's the point of ID might i add, it IDentifies the column and should have a value. Also use a better subject line than "pls help me" that's just sucky.... |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > pls help me |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|