navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
FrontPage Alternative
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

 

here's my code for displaying a record's id

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> here's my code for displaying a record's id
Page: [1]
 
Guest


 
here's my code for displaying a record's id - 4/10/2001 20:26:00   
i want to display a just-submitted-record id, and this is my code (followed Vince's sugesstion):

<%

name=request.querystring("name")
scode=request.querystring("scode")
amt=request.querystring("amt")
amttype=request.querystring("amttype")
num_months=request.querystring("num_months")
start_month=request.querystring("start_month")
con_impact_yr=request.querystring("con_impact_yr")
spot_impact_mo=request.querystring("spot_impact_mo")
spot_impact_yr=request.querystring("spot_impact_yr")
org_impact=request.querystring("org_impact")
reduction_type=request.querystring("reduction_type")
com_prefix=request.querystring("com_prefix")
com_code=request.querystring("com_code")
com_team=request.querystring("com_team")
source=request.querystring("source")

DSN_NAME = "DBQ=" & Server.MapPath("..\fpdb\gportdbase.mdb") & ";Driver={Microsoft Access Driver (*.mdb)}; MaxBufferSize=8192;Threads=20;"
Set Conn = Server.CreateObject("ADODB.Connection")
conn.open DSN_NAME, 3, 3

Const adOpenKeyset = 2
Const adLockPessimistic = 2
Const adCmdText = &H0001
Set RS = Server.CreateObject("ADODB.Recordset")
SQL = "Select * from gporttble"
RS.Open SQL, Conn, adOpenKeyset, adLockPessimistic, adCMDText

if amttype="SPOT" then
dim myID

RS.ADDNEW
RS("name") = name
RS("scode") = scode
RS("amt") = amt
RS("amttype") = amttype
RS("spot_impact_mo") = spot_impact_mo
RS("spot_impact_yr") = spot_impact_yr
RS("org_impact") = org_impact
RS("reduction_type") = reduction_type
RS("com_prefix") = com_prefix
RS("com_code") = com_code
RS("com_team") = com_team
RS("source") = source
RS("realdatesubmit") = Date
myDate=DateValue(spot_impact_mo & "/" & "1" & "/" & spot_impact_yr)
RS("datesubmit") = myDate
RS.Update
myID = RS("ID")
Response.Write myID
Response.Write "<strong>SPOT</strong> -"
Response.Write "This single record was added into the database. " & "<p>"
end if
Conn.close
Set Conn=nothing
%>

However, it didn't print myID. Please helpppppppppp!!!!!!!!!!!!

Vince from Spain

 

Posts: 658
From: Madrid Spain
Status: offline

 
RE: here's my code for displaying a record's id - 4/10/2001 20:22:00   
Hi Bebe,
have a look at this code, pretty much like yours but trimmed so I could test it. I have changed the type of connection which is important, but will work the same. One other important difference is that you have the constant for adOpenKeyset wrong, it should be . . .
Const adOpenKeyset = 1

If just changing this does not do it, change the connections to something like this . . .

<%
Dim name, url, tel, DSN_NAME, Conn, RS, SQL
name="vbcvvbbvb"
url="http:/nbnbnbnb.com"
tel="6636363"

DSN_NAME = "DBQ=" & Server.MapPath("test.mdb") & ";Driver={Microsoft Access Driver (*.mdb)}; MaxBufferSize=8192;Threads=20;"
Set Conn = Server.CreateObject("ADODB.Connection")
conn.open DSN_NAME, 3, 3

Const adOpenKeyset = 1
Const adLockOptimistic = 3
Const adCmdTable = 2
Set RS = Server.CreateObject("ADODB.Recordset")
RS.Open "results", Conn, adOpenKeySet, adLockOptimistic, adCmdTable

dim myID

RS.ADDNEW
RS("name") = name
RS("url") = url
RS("tel") = tel
RS.Update
myID = RS("ID")
Response.Write myID
Response.Write "<strong>SPOT</strong> -"
Response.Write "This single record was added into the database. " & "<p>"

Conn.close
Set Conn=nothing
%>

------------------
Internet Business Solutions S.L.(Spain)


(in reply to Guest)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> here's my code for displaying a record's id
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts