Hello...
I have a problem here...
How do i make an asp using database using this script...

<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<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>
</head>

<body>
<div id="Layer1" style="position:absolute; width:883px; height:749px; z-index:1; left: 71px; top: 65px;">
  <div align="center">
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <table width="554" height="395">
      <tr>
        <td width="174"><div align="right">Gambar : </div></td>
        <td width="364"><form name="form1" method="post" action="">
          <input name="Gambar" type="text" id="Gambar">
          <input name="Browse" type="reset" value="Browse">
        </form></td>
      </tr>
      <tr>
        <td><div align="right">Nama Pegawai : </div></td>
        <td><form name="form2" method="post" action="">
          <input type="text" name="textfield">
        </form></td>
      </tr>
      <tr>
        <td><div align="right">Jawatan : </div></td>
        <td><form name="form3" method="post" action="">
          <input type="text" name="textfield2">
        </form></td>
      </tr>
      <tr>
        <td><div align="right">Gelaran/Posisi : </div></td>
        <td><form name="form4" method="post" action="">
          <input type="text" name="textfield3">
        </form></td>
      </tr>
      <tr>
        <td><div align="right">Bahagian : </div></td>
        <td><input type="text" name="textfield4"></td>
      </tr>
      <tr>
        <td><div align="right">Cawangan/Unit : </div></td>
        <td><form name="form5" method="post" action="">
          <input type="text" name="textfield5">
        </form></td>
      </tr>
      <tr>
        <td><div align="right">E-mail : </div></td>
        <td><form name="form6" method="post" action="">
          <input type="text" name="textfield6">
        </form></td>
      </tr>
      <tr>
        <td><div align="right">Telefon : </div></td>
        <td><p>Pejabat : 
            <input type="text" name="textfield7">
        </p>
        <p>Lain-lain : 
          <input type="text" name="textfield8">
        </p>
        </td>
      </tr>
      <tr>
        <td><div align="right">Ringkasan Tugas : </div></td>
        <td><form name="form7" method="post" action="">
          <textarea name="textarea"></textarea>
        </form></td>
      </tr>
    </table>
    <div id="Layer2" style="position:absolute; width:110px; height:50px; z-index:2; left: 281px; top: 569px;">
      <form name="form8" method="post" action="">
        <input type="submit" name="Submit" value="Submit">
      </form>
    </div>
    <p>&nbsp;</p>
    <div id="Layer3" style="position:absolute; width:137px; height:49px; z-index:2; left: 416px; top: 571px;">
      <form name="form9" method="post" action="">
        <input type="Reset" name="Reset" value="Clear">
      </form>
    </div>
  </div>
</div>
</body>
</html>

Your help is much appreciated...

Recommended Answers

All 4 Replies

You need to connect to your MS Access database, open a new recordset, then insert the information. It's an easy process, however, you should always do validation on what you're inserting, which is what makes it a bit more difficult and lengthy.

Find a connection string at : http://www.connectionstrings.com
Then your code should be something like this:

Dim strDbConnection
Dim objConn
Dim strSQL
strDbConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\test.mdb;"
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open(strDbConnection)
strSQL = "INSERT INTO persons (fullname, birthDate) VALUES ('" & Request.Form("fieldname") & "', '" & Request.Form("fieldname") & "')"
objConn.Execute(strSQL)
objConn.Close()
Set objConn = Nothing

Just keep in mind, interger fields (Int, Bigint, etc.) do not need single quotes.

Alright I will try it...
Thanks for the tips..

well mail me yr question... _saru@hotmail.com
=========

Hello...
I have a problem here...
How do i make an asp using database using this script...

<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<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>
</head>

<body>
<div id="Layer1" style="position:absolute; width:883px; height:749px; z-index:1; left: 71px; top: 65px;">
  <div align="center">
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <table width="554" height="395">
      <tr>
        <td width="174"><div align="right">Gambar : </div></td>
        <td width="364"><form name="form1" method="post" action="">
          <input name="Gambar" type="text" id="Gambar">
          <input name="Browse" type="reset" value="Browse">
        </form></td>
      </tr>
      <tr>
        <td><div align="right">Nama Pegawai : </div></td>
        <td><form name="form2" method="post" action="">
          <input type="text" name="textfield">
        </form></td>
      </tr>
      <tr>
        <td><div align="right">Jawatan : </div></td>
        <td><form name="form3" method="post" action="">
          <input type="text" name="textfield2">
        </form></td>
      </tr>
      <tr>
        <td><div align="right">Gelaran/Posisi : </div></td>
        <td><form name="form4" method="post" action="">
          <input type="text" name="textfield3">
        </form></td>
      </tr>
      <tr>
        <td><div align="right">Bahagian : </div></td>
        <td><input type="text" name="textfield4"></td>
      </tr>
      <tr>
        <td><div align="right">Cawangan/Unit : </div></td>
        <td><form name="form5" method="post" action="">
          <input type="text" name="textfield5">
        </form></td>
      </tr>
      <tr>
        <td><div align="right">E-mail : </div></td>
        <td><form name="form6" method="post" action="">
          <input type="text" name="textfield6">
        </form></td>
      </tr>
      <tr>
        <td><div align="right">Telefon : </div></td>
        <td><p>Pejabat : 
            <input type="text" name="textfield7">
        </p>
        <p>Lain-lain : 
          <input type="text" name="textfield8">
        </p>
        </td>
      </tr>
      <tr>
        <td><div align="right">Ringkasan Tugas : </div></td>
        <td><form name="form7" method="post" action="">
          <textarea name="textarea"></textarea>
        </form></td>
      </tr>
    </table>
    <div id="Layer2" style="position:absolute; width:110px; height:50px; z-index:2; left: 281px; top: 569px;">
      <form name="form8" method="post" action="">
        <input type="submit" name="Submit" value="Submit">
      </form>
    </div>
    <p>&nbsp;</p>
    <div id="Layer3" style="position:absolute; width:137px; height:49px; z-index:2; left: 416px; top: 571px;">
      <form name="form9" method="post" action="">
        <input type="Reset" name="Reset" value="Clear">
      </form>
    </div>
  </div>
</div>
</body>
</html>

Your help is much appreciated...

New problem...
Now i have to change not using access but using SQL server...
Does the code still the same?
Btw for your info I don't know anything about ASP...
Consider I am a newbie on this kind of thing..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.