Forums

ASP

This topic is locked

duplicates

Posted 04 Nov 2001 10:57:29
1
has voted
04 Nov 2001 10:57:29 jon badda posted:
I need away of making it so that if the values of UserID and ProductID in my Orders table are equal, then to not insert any more.

Basically, if the a user orders the same product then dont enter it.

several ideas havent worked, the last solution that didnt work was making both columns indexed(no duplicates) ...

so...is there help to be found? or a handy extension perhaps? Im at an end here.

ta

Replies

Replied 04 Nov 2001 23:55:38
04 Nov 2001 23:55:38 Some One replied:
take a look this

---------------------
<%
Dim sepetkontrol__MMColParam, sepetkontrol__MMColParam2
sepetkontrol__MMColParam = aktif_uye.Fields.Item("uye_id".Value
sepetkontrol__MMColParam2 = Request.Querystring("urun"

set sepetkontrol = Server.CreateObject("ADODB.Recordset"
sepetkontrol.ActiveConnection = MM_zafer_STRING
sepetkontrol.Source = "SELECT * FROM sepet WHERE uye_id = " + Replace(sepetkontrol__MMColParam, "'", "''" + " AND urun =" & sepetkontrol__MMColParam2
sepetkontrol.CursorType = 0
sepetkontrol.CursorLocation = 2
sepetkontrol.LockType = 3
sepetkontrol.Open()
sepetkontrol_numRows = 0
%>

<% If sepetkontrol.EOF And sepetkontrol.BOF Then
urundurum = 1
End If ' end sepetkontrol.EOF And sepetkontrol.BOF %>

<%
if urundurum = "1" Then ' Eğer bu üründen daha önce sepetinde yoksa
Dim aktif_uye2
aktif_uye2 = aktif_uye.Fields.Item("uye_id".Value
set sekle = Server.CreateObject("ADODB.Recordset"
sekle.ActiveConnection = MM_zafer_STRING
sekle.Source = "SELECT * FROM sepet"
sekle.CursorType = 3
sekle.CursorLocation = 2
sekle.LockType = 2
sekle.Open()
sekle_numRows = 0

Dim urun_id, uye_id
uye_id = aktif_uye.Fields.Item("uye_id".Value
urun_id = Request.Querystring("urun"
sekle.addnew
sekle ("urun" = (urun_id)
sekle ("uye_id" = (uye_id)
sekle ("sayi" = ("1"
sekle.update
sekle.Close()

Else ' Eğer bu üründen bir tanesine sahipse sayısını arttır

Dim ekle, eklenenesayi
eklenen = "1"
if Request.Querystring("eklenen" <> "" then
eklenen = Request.Querystring("eklenen"
End if

ekle = sepetkontrol.Fields.Item("sayi".Value + eklenen

set say = Server.CreateObject("ADODB.Command"
say.ActiveConnection = MM_zafer_STRING
say.CommandText = "UPDATE sepet SET sayi = " + Replace(ekle, "'", "''" + " WHERE uye_id = " + Replace(sepetkontrol__MMColParam, "'", "''" + " AND urun =" & sepetkontrol__MMColParam2
say.CommandType = 1
say.CommandTimeout = 0
say.Prepared = true
say.Execute()

End if


sdi ::: pixels to blood
Replied 06 Nov 2001 22:56:07
06 Nov 2001 22:56:07 jon badda replied:
ok...wow. thanks...

erm, i cant quite make out what it says though, or what it means...but i'll give it a burl regardless.

but if you could reply and tell me what it does...

i wonder if a NT host can interpret asp code in different languages...??

Reply to this topic