I am adding a record in Access database using AddNew method of recordset. here is the code of the page ..
Expand|Select|Wrap|Line Numbers
- <%
- Set RsLibBuild = Server.CreateObject ("ADODB.Recordset")
- RsLibBuild.ActiveConnection = conn
- RsLibBuild.LockType = 2
- RsLibBuild.CursorType = 1
- RsLibBuild.Open "select * from tblbuilding where building_name='" & request.Form ("buildingname") & "' and area_name='" & request.Form ("areaname") & "' and city_name='" & request.Form ("cityname") & "' and lib_status='1'"
- if RsLibBuild.EOF or RsLibBuild.BOF then
- RsLibBuild.AddNew
- RsLibBuild ("building_name") = Request.Form ("buildingname")
- RsLibBuild ("area_name") = Request.Form ("areaname")
- RsLibBuild ("city_name") = Request.Form ("cityname")
- RsLibBuild ("description") = Request.Form ("thecontent")
- RsLibBuild ("lib_status") = "1"
- RsLibBuild ("dated") = date
- RsLibBuild ("timed") = time
- RsLibBuild ("logby") = session("uname")
- RsLibBuild.Update
- RsLibBuild.Close
- set RsLibBuild = nothing
- Msg = "1 Record Added .... "
- Response.Redirect "buildingsnap.asp?id="& request.Form("buildingname") &"&ConfMsg="&Msg
- else
- RsLibBuild.Close
- set RsLibBuild = nothing
- Msg = "Record already exists .... "
- Response.Redirect "addlibbuilding.asp?ErrMsg="&Msg
- end if
- %>
Record is being added but redirection of page is wrong. If i comment the RsBuilding.update line in above mentioned code then it works fine and redirect propery.
A quick response will be highly appreciated..
Thanx in adv.
Raaaz