|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
1200+ fellow developers rate and compare features of the top IDEs, like Visual Studio, Eclipse, RAD, Delphi and others, across 13 categories. Enjoy this FREE Download of the IDE User Satisfaction Study by Evans Data Corporation. Download Now!
|
|
#1
|
|||
|
|||
|
Hi all,
i have aproblem to transfer a data from table x to table y based on id. Its mean when 2 table have same id all data table x must move to table y. I don't know which command need to use is it insert into or update? Can someone help me, i'm new in ASP programming. here the script i make it <% 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;pwd=sa" conn.Open startdate=request("tarikh1") enddate=request("tarikh2") MYSQL = "SELECT * FROM table_x where paymentdate between '" & tarikh1 & "' and '" & tarikh2 & "'" rs.open MYSQL,conn if rs.EOF then response.Write("no data") else if ([table_x.id] = [table_y.id]) then MYSQL2 = "INSERT INTO table_y (paymentdate, status, no_resit) values ('" & rs ("paymentdate") & "', '" & rs ("status") & "', '" & rs ("no_resit") & "')" Set rs = conn.Execute(MYSQL2) response.write "<p>" & "<center>" & "All data have been done to transfer" & "</center>" & "</p>" response.write "<p>" & "<A HREF=javascript:history.go(-1)>" & "GoBack" & "</a>" else response.write "Cannot transferring the data" response.write "<p>" & "<A HREF=javascript:history.go(-1)>" & "GoBack" & "</a>" end if end if Set rs = Nothing Set conn = Nothing %> the error meesage 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.table_y'; column does not allow nulls. INSERT fails. i don't understand i'm not insert the id |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > How to transfer records from one table of a database to another table in another data |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|