Avatar billede Slettet bruger
18. august 1999 - 19:19 Der er 1 løsning

Ændring til DNS Less

Er der nogen der kan hjælpe mig med at få følgende script lavet om til et DNS less?

<%@ LANGUAGE=VBScript %>
<html>
<head>
<meta NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<title>User Registration Database</title>
</head>
<body>
<%
Sub GetUserEmailAddress %>

<p><font face="Arial" size="4" style="BACKGROUND-COLOR: #ffff99"> Indtast venligst
  ProduktID.</font></p>
<p>P&aring; den m&aring;de kan vi finde frem til det &oslash;nskede produkt.</p>

<p>
<form method="POST" action="AddOrModifyUserInformation.asp" id="EmailForm" name="EmailForm">
  Indtast ProduktID her
  <input type="text" id="prodid" size="35" name="prodid">
  <br>
  <input type="submit" value="Send Foresp&oslash;rgsel" id="sendprodid" name="sendprodid">
</form>
<p></p>
<%
End Sub

' =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Sub UpdateUserInformation %>
<p><font face="Arial" size="4" style="BACKGROUND-COLOR: #ffcc99"> Produktet findes
  i vores database.</font></p>
<p> Redig&eacute;r i produktspecifikationen herunder og afslut med knappen Opdat&eacute;r.</p>



<!--webbot BOT="GeneratedScript" PREVIEW=" " startspan --><script Language="JavaScript"><!--
function FrontPage_Form3_Validator(theForm)
{

  if (theForm.prodid.value == "")
  {
    alert("Please enter a value for the \"prodid\" field.");
    theForm.prodid.focus();
    return (false);
  }

  if (theForm.prodid.value.length < 2)
  {
    alert("Please enter at least 2 characters in the \"prodid\" field.");
    theForm.prodid.focus();
    return (false);
  }

  if (theForm.prodid.value.length > 30)
  {
    alert("Please enter at most 30 characters in the \"prodid\" field.");
    theForm.prodid.focus();
    return (false);
  }

  if (theForm.prodnavn.value == "")
  {
    alert("Please enter a value for the \"prodnavn\" field.");
    theForm.prodnavn.focus();
    return (false);
  }

  if (theForm.prodnavn.value.length < 2)
  {
    alert("Please enter at least 2 characters in the \"prodnavn\" field.");
    theForm.prodnavn.focus();
    return (false);
  }

  if (theForm.prodnavn.value.length > 30)
  {
    alert("Please enter at most 30 characters in the \"prodnavn\" field.");
    theForm.prodnavn.focus();
    return (false);
  }

  if (theForm.prodbesk.value == "")
  {
    alert("Please enter a value for the \"prodbesk\" field.");
    theForm.prodbesk.focus();
    return (false);
  }

  if (theForm.prodbesk.value.length < 7)
  {
    alert("Please enter at least 7 characters in the \"prodbesk\" field.");
    theForm.prodbesk.focus();
    return (false);
  }

  if (theForm.prodbesk.value.length > 49)
  {
    alert("Please enter at most 49 characters in the \"prodbesk\" field.");
    theForm.prodbesk.focus();
    return (false);
  }

  if (theForm.antal.value == "")
  {
    alert("Please enter a value for the \"antal\" field.");
    theForm.antal.focus();
    return (false);
  }

  if (theForm.antal.value.length < 2)
  {
    alert("Please enter at least 2 characters in the \"antal\" field.");
    theForm.antal.focus();
    return (false);
  }

  if (theForm.antal.value.length > 2)
  {
    alert("Please enter at most 2 characters in the \"antal\" field.");
    theForm.State.focus();
    return (false);
  }

  if (theForm.billede.value == "")
  {
    alert("Please enter a value for the \"billede\" field.");
    theForm.billede.focus();
    return (false);
  }

  if (theForm.billede.value.length < 3)
  {
    alert("Please enter at least 3 characters in the \"billede\" field.");
    theForm.billede.focus();
    return (false);
  }

  if (theForm.billede.value.length > 30)
  {
    alert("Please enter at most 30 characters in the \"billede\" field.");
    theForm.billede.focus();
    return (false);
  }

  if (theForm.indkob.value == "")
  {
    alert("Please enter a value for the \"indkob\" field.");
    theForm.indkob.focus();
    return (false);
  }

  if (theForm.indkob.value.length < 3)
  {
    alert("Please enter at least 3 characters in the \"indkob\" field.");
    theForm.indkob.focus();
    return (false);
  }

  if (theForm.indkob.value.length > 30)
  {
    alert("Please enter at most 30 characters in the \"indkob\" field.");
    theForm.indkob.focus();
    return (false);
  }
  return (true);
}
//--></script><!--webbot BOT="GeneratedScript" endspan --><form method="POST" action="ModifyUserEntry.asp" onsubmit="return FrontPage_Form3_Validator(this)" name="FrontPage_Form3">
  <p><strong><font face="Arial">Du kan nu begynde at redigere.</font></strong></p>
  <table width="46%" border="1">
    <tr>
      <td width="53%">ProduktID</td>
      <td width="47%"><!--webbot bot="Validation" S-Display-Name="prodid" B-Value-Required="TRUE" I-Minimum-Length="2" I-Maximum-Length="30" -->
        <input type="text" name="prodid" size="12" maxlength="30" value="<%= beatboxRecordset("ProduktID")%>">
      </td>
    </tr>
    <tr>
      <td width="53%">Produkt Navn</td>
      <td width="47%"><!--webbot bot="Validation" S-Display-Name="prodnavn" B-Value-Required="TRUE" I-Minimum-Length="2" I-Maximum-Length="30" -->
        <input type="text" name="prodnavn" size="12" maxlength="30" value="<%= beatboxRecordset("Produktnavn")%>">
      </td>
    </tr>
    <tr>
      <td width="53%">Produktbeskrivelse</td>
      <td width="47%"><!--webbot bot="Validation" S-Display-Name="prodbesk" B-Value-Required="TRUE" I-Minimum-Length="7" I-Maximum-Length="49" -->
        <input type="text" name="prodbesk" value="<%= beatboxRecordset("Produktbeskrivelse")%>">
      </td>
    </tr>
    <tr>
      <td width="53%">Antal</td>
      <td width="47%"><!--webbot bot="Validation" S-Display-Name="antal" B-Value-Required="TRUE" I-Minimum-Length="3" I-Maximum-Length="30" -->
        <input type="text" name="antal" size="2" maxlength="2" value="<%= beatboxRecordset("Antal")%>">
      </td>
    </tr>
    <tr>
      <td width="53%">Billede</td>
      <td width="47%"><!--webbot bot="Validation" S-Display-Name="billede" B-Value-Required="TRUE" I-Minimum-Length="3" I-Maximum-Length="30" -->
        <input type="text" name="billede" size="15" value="<%= beatboxRecordset("Billede")%>" maxlength="30">
      </td>
    </tr>
    <tr>
      <td width="53%">Indk&oslash;bslink</td>
      <td width="47%"><!--webbot bot="Validation" S-Display-Name="indkob" B-Value-Required="TRUE" I-Minimum-Length="2" I-Maximum-Length="2" -->
        <input type="text" name="indkob" size="20" maxlength="30" value="<%= beatboxRecordset("Indkobsvogn")%>">
      </td>
    </tr>
    <tr>
      <td width="53%">&nbsp;</td>
      <td width="47%">&nbsp;</td>
    </tr>
    <tr>
      <td width="53%">&nbsp;</td>
      <td width="47%">&nbsp;</td>
    </tr>
    <tr>
      <td width="53%">&nbsp;</td>
      <td width="47%">&nbsp;</td>
    </tr>
  </table>
  <div align="left"></div>
 
  <p>
    <input type="hidden" name="nummer" value="<%= beatboxRecordset("Autonummer")%>">
    <input type="submit" value="Opdater Databasen" name="SubmitButton">
  </p>
</form>

<%
End Sub

' =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
' Main Program Block
' =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

  Dim SQLString

 
  If Request.Form.Item("prodid") = "" Then
    Call GetUserEmailAddress
  Else

  ' This SQL string retrieves all the selected records from the
  ' of the User Regsitration database
  SQLString = "SELECT Autonummer, ProduktID, Produktnavn, Produktbeskrivelse, " & _
    "Antal, Billede, Indkobsvogn " & _
    "FROM beatbox WHERE ProduktID=" & chr(39) & _
    Request.Form.Item("prodid") & chr(39)

  ' Create an instance of the Connection Object
  Set DatabaseConnection = Server.CreateObject("ADODB.Connection")

  ' Open a connection to the Guest Book File DSN
  ' Before the following statement can execute properly, you have to
  ' create a File DSN for the Guest Book database as outlined in the
  ' book.
  DatabaseConnection.Open  "FILEDSN=BeatBox.dsn"

  ' Create an Instance of the Recordset object
  Set beatboxRecordset = Server.CreateObject("ADODB.Recordset")

  ' The Open method of the Recordset Object is used to retrieve
  ' data from the Guest Book database. 
  beatboxRecordset.Open SQLString, DatabaseConnection

  If beatboxRecordset.EOF Then 
    Call GetUserEmailAddress
  Else
    Call UpdateUserInformation     
  End If 
 
  ' We always release resources after we are done using them.
  ' Always close your database connections after you are done using
  ' them.
  beatboxRecordset.Close
    DatabaseConnection.Close 

  End If

%>

<hr>
<a href="Default.asp">Return to the main menu</a>.<br>
It is now <%= Date %> at <%= Time %>.

</body>
</html>
Avatar billede asp Nybegynder
18. august 1999 - 19:27 #1
Du skal blot ændre linien:

DatabaseConnection.Open  "FILEDSN=BeatBox.dsn"

Til:

DatabaseConnection.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath ("database.mdb")

Du kan finde reference på:

http://www.activeserverpages.dk/aspdigital/kapitel2/dsnless.asp

Mvh.

Dennis Knappe
info@ActiveServerPages.DK
http://www.ActiveServerPages.DK

Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester