» »

ASP

ASP

Sportmania ::

Pozdravljeni!

Delam neko dinamično spletišče v Dreamweaver MX 8 (v šoli mamo to) in jasno vse delam z očmi (miško). Sedaj pa se mi nekaj zatakne nekako razumem ampak nimam toliko asp znanja, da bi lahko popravil. Zadeva je sledeča:
imam bazo kjer urejam zapise in potem se mi zadeva podre, ko npr: prvič uredim nek zapis in potem hočem takoj drugega, ker spremenljivka ID se ne izprazni ob osvežitvi ampak obdrži vrednost in potem, ko hočem takoj spet urejevat je ID="1,2" moral pa bi bit jasno ID="2".

Upam, da sem dovolj nazorno razložil rabil bi nekoga, da mi razloži kako v kodi nastavim, da se ID ob osvežitvi izprazni (postavi na privzeto vrednost "").

Urejevanje poteka prek URL parametra ID.

Napaka:
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Syntax error (comma) in query expression 'ID = 1, 1'.
/fajfa/uredi_film.asp, line 138


Lp!


techfreak :) ::

id = ""

Sportmania ::

Ja recmo, da se mi je zdel ampak da bo tko ampak kam prbližn bi pa jz to mogu dat. Heh, če bi blo tko lahko seveda nebi sprašvou koda je pa taka:
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/Knjige.asp" -->
<%
' *** Edit Operations: declare variables

Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd

Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId

Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i

MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
  MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If

' boolean to abort record edit
MM_abortEdit = false

' query string to execute
MM_editQuery = ""
%>
<%
' *** Delete Record: declare variables

if (CStr(Request("MM_delete")) = "form1" And CStr(Request("MM_recordId")) <> "") Then

  MM_editConnection = MM_Knjige_STRING
  MM_editTable = "Knjige"
  MM_editColumn = "ID_knjige"
  MM_recordId = "" + Request.Form("MM_recordId") + ""
  MM_editRedirectUrl = "uredi_k.asp"

  ' append the query string to the redirect URL
  If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
    If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
      MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
    Else
      MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
    End If
  End If
  
End If
%>
<%
' *** Delete Record: construct a sql delete statement and execute it

If (CStr(Request("MM_delete")) <> "" And CStr(Request("MM_recordId")) <> "") Then

  ' create the sql delete statement
  MM_editQuery = "delete from " & MM_editTable & " where " & MM_editColumn & " = " & MM_recordId

  If (Not MM_abortEdit) Then
    ' execute the delete
    Set MM_editCmd = Server.CreateObject("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_editConnection
    MM_editCmd.CommandText = MM_editQuery
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close

    If (MM_editRedirectUrl <> "") Then
      Response.Redirect(MM_editRedirectUrl)
    End If
  End If

End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_Knjige_STRING
Recordset1.Source = "SELECT * FROM Knjige"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = -1
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%>
<%
Dim MM_paramName 
%>
<%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters

Dim MM_keepNone
Dim MM_keepURL
Dim MM_keepForm
Dim MM_keepBoth

Dim MM_removeList
Dim MM_item
Dim MM_nextItem

' create the list of parameters which should not be maintained
MM_removeList = "&index="
If (MM_paramName <> "") Then
  MM_removeList = MM_removeList & "&" & MM_paramName & "="
End If

MM_keepURL=""
MM_keepForm=""
MM_keepBoth=""
MM_keepNone=""

' add the URL parameters to the MM_keepURL string
For Each MM_item In Request.QueryString
  MM_nextItem = "&" & MM_item & "="
  If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
    MM_keepURL = MM_keepURL & MM_nextItem & Server.URLencode(Request.QueryString(MM_item))
  End If
Next

' add the Form variables to the MM_keepForm string
For Each MM_item In Request.Form
  MM_nextItem = "&" & MM_item & "="
  If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
    MM_keepForm = MM_keepForm & MM_nextItem & Server.URLencode(Request.Form(MM_item))
  End If
Next

' create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL & MM_keepForm
If (MM_keepBoth <> "") Then 
  MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
End If
If (MM_keepURL <> "")  Then
  MM_keepURL  = Right(MM_keepURL, Len(MM_keepURL) - 1)
End If
If (MM_keepForm <> "") Then
  MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)
End If

' a utility function used for adding additional parameters to these strings
Function MM_joinChar(firstItem)
  If (firstItem <> "") Then
    MM_joinChar = "&"
  Else
    MM_joinChar = ""
  End If
End Function
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Knjige</title>
<html xmlns="http://www.w3.org/1999/xhtml">
<style type="text/css">
<!--
.style2 {color: #FFFF00}
-->
</style>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Domov</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
<!--[if IE]>
<style type="text/css">
#sidebar #calendar {
	background-position: 0px 20px;
}
</style>
<![endif]-->

<body>
<div id="logo">
	<h1><a href="#">Knjige</a></h1>
	<h2>Designed by: Cime </h2>
	    <img src="images/admin.png" alt="Admin" width="128" height="128" longdesc="images/admin.png" /></div>
<div id="menu">
	<ul>
		<li class="first"><a href="index.asp" accesskey="1" title="">Domov</a></li>
		<li><a href="knjige.asp" accesskey="2" title="">Knjige</a></li>
		<li><a href="filmi.asp" accesskey="3" title="">Filmi</a></li>
		<li><a href="zelje.asp" accesskey="4" title="">&#381;elje</a></li>
		<li><a href="kontakt.asp" accesskey="5" title="">Kontakt</a></li>
		<li><a href="rss.asp" accesskey="6" title="">RSS</a></li>
	</ul>
	<div id="search">
		<form method="get" action="">
			<fieldset>
			<input id="s" type="text" name="s" value="" />
			<input id="x" type="image" name="imageField" src="images/img10.jpg" />
			</fieldset>
		</form>
	</div>
</div>
<hr />
<div id="banner"><img src="images/Banner.jpg" alt="Banner" width="961" height="204" longdesc="images/Banner.jpg" /></div>
<!-- start page -->
<div id="page">
	<!-- start content -->
	<div id="content">
	  <div class="post">
			<h2 class="title"><a href="#">Uredi knjigo  : </a></h2>
			<p class="title">&nbsp;</p>
			<table border="1">
              <tr>
                <td>ID_knjige</td>
                <td>Priimek_avtorja</td>
                <td>Ime_avtorja</td>
                <td>Naslov</td>
                <td>Strani</td>
                <td>Cena</td>
                <td>Leto</td>
                <td>Uredi</td>
                <td>Izbri&scaron;i</td>
              </tr>
              <% While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF)) %>
                <tr>
                  <td><%=(Recordset1.Fields.Item("ID_knjige").Value)%></td>
                  <td><%=(Recordset1.Fields.Item("Priimek_avtorja").Value)%></td>
                  <td><%=(Recordset1.Fields.Item("Ime_avtorja").Value)%></td>
                  <td><%=(Recordset1.Fields.Item("Naslov").Value)%></td>
                  <td><%=(Recordset1.Fields.Item("Strani").Value)%></td>
                  <td><%=(Recordset1.Fields.Item("Cena").Value)%></td>
                  <td><%=(Recordset1.Fields.Item("Leto").Value)%></td>
                  <td><A HREF="uredi_knjigo.asp?<%= Server.HTMLEncode(MM_keepURL) & MM_joinChar(MM_keepURL) & "ID_knjige=" & Recordset1.Fields.Item("ID_knjige").Value %>">uredi</A></td>
                  <td><form id="form1" name="form1" method="POST" action="<%=MM_editAction%>">
                    <label>
                    <input type="submit" name="Submit" value="Bri&scaron;i" />
                    </label>
                    <input type="hidden" name="MM_delete" value="form1">
                    <input type="hidden" name="MM_recordId" value="<%= Recordset1.Fields.Item("ID_knjige").Value %>">
                  </form>
                  </td>
                </tr>
                <% 
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  Recordset1.MoveNext()
Wend
%>
            </table>
	  </div>
	  <div class="post">
			<h3 align="center" class="title">&nbsp;</h3>
			<h3 align="center" class="title"><a href="#">Na vrh  </a></h3>
			<p class="meta">Nazadnje popravil  <strong>Cime</strong> 13. septembra 2010 </p>
	  </div>
	</div>
	<!-- end content -->
	<!-- start sidebar -->
	<!-- end sidebar --></div>
<!-- end page -->
<div id="footer">
	<p class="legal">Copyright (c) 2010 Knjižnjica. All rights reserved.</p>
	<p class="credit">Coded and trasleted by: Cime <a href="http://www.freecsstemplates.org/"></a></p>
</div>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>





Vredno ogleda ...

TemaSporočilaOglediZadnje sporočilo
TemaSporočilaOglediZadnje sporočilo
»

C programiranje (strani: 1 2 3 )

Oddelek: Programiranje
14127717 (18013) amacar
»

MS Access (strani: 1 2 )

Oddelek: Programiranje
647409 (5467) travica
»

PHP in objektno programiranje (strani: 1 2 )

Oddelek: Programiranje
8512098 (10565) kivi113
»

[php] Knjiga gostov

Oddelek: Izdelava spletišč
293159 (2362) darix
»

HTML forma in datum

Oddelek: Izdelava spletišč
131795 (1531) Muzo

Več podobnih tem