User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP section within the Web Development category of DaniWeb, a massive community of 373,370 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,816 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP advertiser: Lunarpages ASP Web Hosting
Views: 930 | Replies: 4
Reply
Join Date: Jan 2008
Location: +3.187105,+101.645363
Posts: 394
Reputation: Anonymous86 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
Anonymous86's Avatar
Anonymous86 Anonymous86 is offline Offline
Posting Whiz

Make an asp with database (access)

  #1  
Feb 4th, 2008
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...
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Sep 2007
Posts: 1,054
Reputation: SheSaidImaPregy is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 61
SheSaidImaPregy SheSaidImaPregy is offline Offline
Veteran Poster

Re: Make an asp with database (access)

  #2  
Feb 5th, 2008
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.
Reply With Quote  
Join Date: Jan 2008
Location: +3.187105,+101.645363
Posts: 394
Reputation: Anonymous86 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
Anonymous86's Avatar
Anonymous86 Anonymous86 is offline Offline
Posting Whiz

Re: Make an asp with database (access)

  #3  
Feb 10th, 2008
Alright I will try it...
Thanks for the tips..
The road to success is always under construction.
Reply With Quote  
Join Date: Sep 2007
Posts: 11
Reputation: smart_saru is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
smart_saru smart_saru is offline Offline
Newbie Poster

Re: Make an asp with database (access)

  #4  
Feb 20th, 2008
well mail me yr question... _saru@hotmail.com
=========
Originally Posted by Anonymous86 View Post
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...
Reply With Quote  
Join Date: Jan 2008
Location: +3.187105,+101.645363
Posts: 394
Reputation: Anonymous86 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
Anonymous86's Avatar
Anonymous86 Anonymous86 is offline Offline
Posting Whiz

Re: Make an asp with database (access)

  #5  
Feb 26th, 2008
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..
The road to success is always under construction.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb ASP Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the ASP Forum

All times are GMT -4. The time now is 2:53 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC