hello guys.. im using dreamweaver to develop my website, its my practical project.. specs: Microsoft Acces 2000, macromedia dreamweaver mx 2004, IIS and ODBC(for server and database)

i've succesfully connecting dreamweaver and odbc, and also configuring IIS.. right now, i've done the login form, but unfortunately im stuck at inserting new user data(registration form) i have 1 form with 4 value(text field) which is going to be sent into 2 table in my db.. this is where it went wrong, dreamweaver can only allow me to select 1 table per form so i cant make the insertion of the new data successfully.. how am i going to do that? can anyone teach me?

You cannot insert data into two tables in one query, not in ODBC.

You will have to create two separate queries, one to insert data in each table.

INSERT INTO tbl1 (UserName, Password, FullName, DateCreated) VALUES ('" & Trim(Request.Form("username")) & "','" & Trim(Request.Form("password")) & "','" & Trim(Request.Form("FullName")) & "', Now())

Then do the next one but change the table name and values if needed.

this is the original code(im a malaysian, sorry if the word is confusing):

<%@LANGUAGE="VBSCRIPT"%>
<html>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
<link href="CSS_Style1.css" rel="stylesheet" type="text/css">

<style type="text/css">
<!--
.style1 {
	font-family: Haettenschweiler;
	font-weight: bold;
	font-size: 20px;
}
.style2 {color: #0033CC}
.style3 {
	color: #FF0000;
	font-style: italic;
	font-size: 14px;
}
.style4 {color: #660066;
	font-style: italic;
	font-size: 12px;
}
-->
</style>
<title>Pendaftaran Pengguna</title><div id="Layer3" class="style1 style2" style="position:absolute; width:379px; height:22px; z-index:2; left: 61px; top: 23px;">PENDAFTARAN MAKLUMAT PENGGUNA SISTEM</div>
<div id="Layer4" class="style3" style="position:absolute; width:379px; height:18px; z-index:3; left: 61px; top: 50px;">*Sila Isi Semua Maklumat dengan Huruf Besar sahaja</div>
<div id="Layer1" style="position:absolute; width:379px; height:170px; z-index:1; left: 61px; top: 95px;">
  <div id="Layer2" style="position:absolute; width:108px; height:18px; z-index:1; left: 0px; top: 91px;">Bahagian</div>
  <div id="Layer2" style="position:absolute; width:107px; height:18px; z-index:1; left: 1px; top: 33px;">Kata Laluan </div>
  <div id="Layer2" style="position:absolute; width:108px; height:18px; z-index:1; left: 0px; top: 63px;">Jawatan</div>
  <div id="Layer2" style="position:absolute; width:107px; height:18px; z-index:1; left: 1px; top: 0px;">Nama Pengguna </div>
  <div id="Layer2" style="position:absolute; width:244px; height:170px; z-index:1; left: 134px; top: 0px;">
      <form name="formlog" id="formlog" action="proses(daftar).asp">
       <div id="Layer2" style="position:absolute; width:242px; height:18px; z-index:1">
        <input name="nama" type="text" id="nama">
      </div>  
	  <div id="Layer2" style="position:absolute; width:241px; height:18px; z-index:1; left: 1px; top: 31px;">
	    <input name="password" type="text" id="password">
      </div>
	  <div id="Layer2" style="position:absolute; width:242px; height:18px; z-index:1; top: 61px; left: 0px;">
	    <input name="jawatan" type="text" id="jawatan" size="38" maxlength="100">
      </div>
	  <div id="Layer2" style="position:absolute; width:242px; height:18px; z-index:1; top: 90px; left: 0px;">
        <input name="bahagian" type="text" id="bahagian" size="38" maxlength="100">
      </div>
	 <div id="Layer2" style="position:absolute; width:245px; height:34px; z-index:1; left: 0px; top: 130px;">
    	<form name="actionbutton" id="actionbutton" action="PendaftaranPengguna.asp">
	  <div id="Layer2" style="position:absolute; width:65px; height:18px; z-index:1; left: 85px; top: 6px;">
        <input name="Submit" type="submit" class="buttonstyle" value="Simpan">
      </div>	  
	  </div>
      </form>
	  <form name="form1" action="<%response.Redirect("")%>">
	  <div id="Layer2" style="position:absolute; width:97px; height:18px; z-index:1; left: 153px; top: 136px;">
  		<input name="menu utama" type="button" class="buttonstyle" id="menu utama" value="Menu Utama">
		</div></form>
  </div>
</div>
<div id="Layer5" style="position:absolute; left:9px; top:413px; width:486px; height:33px; z-index:5">
  <div align="center" class="style4">Sistem Ini Dibangunkan dan Diselenggarakan Oleh Bahagian Teknologi Maklumat MDKP<br>
    HakCipta Terpelihara.2004.</div>
</div>

</html>

and right now, im trying to use this code:

<% Option explicit %>
<!-- #Include file = "adovbs.inc" -->
<%
  Dim nama, pass, jawatan, bahagian
  Dim con,rs,rs2

  nama = request.form("nama")
  bahagian  = request.form("bahagian")
  pass  = request.form("password")
  jawatan  = request.form("jawatan")
    
  set con=Server.CreateObject("ADODB.Connection")
  con.Mode = adModeReadWrite
  con.Open "Provider=Microsoft.Jet.oledb.4.0;" &_
             "Data Source="& Server.Mappath("\Esubplan\database\SubPlan.mdb") & ";"
  
  set rs=Server.CreateObject("ADODB.RecordSet")
  set rs2=Server.CreateObject("ADODB.RecordSet")
  rs.Open "login", con, adOpenStatic, adLockPessimistic
  rs2.Open "Perjawatan", con, adOpenStatic, adLockPessimistic

  rs.AddNew
  rs("login")= nama
  rs("katalaluan") = pass
  rs.Update

  rs2.AddNew
  rs2("Jawatan")= jawatan
  rs2("Bahagian") = bahagian
  rs2.Update

  rs.Close
  rs2.close
  con.Close
  
  set rs = Nothing
  set rs2 = Nothing
  set con = Nothing
%>

but i get an error, which i believe cause by the multiple fields task.. i get the code to store data on 2 table, 2 fields but with same data and its work fine.. which i try to change into different data to multiple table, multiple fields..

any helps is very apprecited.. thanks in advance

Please put your SQL Query in

rs.open "login",con >> rs.open "Select * from login",con....
rs.Add
rs.Fields("user")="nama"
rs.Fields("password")="password"
rs.Update
Just Like this....

Please put your SQL Query in

rs.open "login",con >> rs.open "Select * from login",con....
rs.Add
rs.Fields("user")="nama"
rs.Fields("password")="password"
rs.Update
Just Like this....

Actually, when you're adding rows, you do not select anything. Proper usage would be:

rs.open
rs.Add
rs.Fields...
rs.Fields...
rs.Update
rs.Requery

This article has been dead for over six months. Start a new discussion instead.