is there any way i can update only some fields in the database excluding primary key ? please help
-
Error Type: Microsoft JET Database Engine (0x80040E21) Index or primary key cannot contain a Null value. /Poonam/updated.asp, line 73 ---------------------------------------------------------------------------- this is my update file <% dim month, day, year, gender,OStats,DStats,SStats,arrVals,arrAll,rs,usr,strSql,strdes,strinter,strfavm,strquote,strfavs,status gender = Request.Form("Gender") month = Request.Form("DOBMonth") day = Request.Form("DOBDay") year = Request.Form("DOBYear") 'arrAll = split(Request.Form ("allBoxes"), ",") 'get the array with the id's that were ticked 'arrVals = split(Request.Form ("chkbox"), ",") 'rs("Looking to")= '& arrVals &' Looking = Trim(Request.Form("ckbox")) status = Request.form("lovestatus") OStats = Request.Form("orientationStatus") DStats = Request.Form("drinkerStatus") SStats = Request.Form("smokerStatus") strdes = Request.Form("description") strinter = Request.Form("interests") strfavs = Request.Form("favoriteSongs") strfavm = Request.Form("movies") strquote = Request.Form("quote") 'Build connection usr=Request.QueryString("nm") set conn = server.CreateObject ("ADODB.Connection") conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.MapPath ("users.mdb") set rs = server.CreateObject ("ADODB.Recordset") 'Open record with entered username rs.Open "select * from userlist where username='"& usr &"'", conn, 3, 3 rs.AddNew rs("username") = usr rs("password") = var rs("fullname") = var2 rs("country") = var3 rs("fld_question") = var4 rs("fld_answer") = var5 rs("fld_email") = var6 rs("fld_visitor_ID") = var7 rs("dd") = day rs("mm") = month rs("yy") = year rs("Status") = status rs("Looking_to") = Looking rs("Gender")=gender rs("Favourite_Quote")= strquote rs("Favourite_Movie")= strfavm rs("Favourite_Bands") = strfavs rs("Sexual_Orientation") = OStats rs("Smoker") = SStats rs("Drinker") = DStats rs("Interests") = strinter rs("About_me") =strdes 'Save record rs.Update set rs=nothing set conn=nothing %>
-
Error Type: Microsoft JET Database Engine (0x80040E21) Index or primary key cannot contain a Null value. /Poonam/updated.asp, line 73 ---------------------------------------------------------------------------- this is my update file <% dim month, day, year, gender,OStats,DStats,SStats,arrVals,arrAll,rs,usr,strSql,strdes,strinter,strfavm,strquote,strfavs,status gender = Request.Form("Gender") month = Request.Form("DOBMonth") day = Request.Form("DOBDay") year = Request.Form("DOBYear") 'arrAll = split(Request.Form ("allBoxes"), ",") 'get the array with the id's that were ticked 'arrVals = split(Request.Form ("chkbox"), ",") 'rs("Looking to")= '& arrVals &' Looking = Trim(Request.Form("ckbox")) status = Request.form("lovestatus") OStats = Request.Form("orientationStatus") DStats = Request.Form("drinkerStatus") SStats = Request.Form("smokerStatus") strdes = Request.Form("description") strinter = Request.Form("interests") strfavs = Request.Form("favoriteSongs") strfavm = Request.Form("movies") strquote = Request.Form("quote") 'Build connection usr=Request.QueryString("nm") set conn = server.CreateObject ("ADODB.Connection") conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.MapPath ("users.mdb") set rs = server.CreateObject ("ADODB.Recordset") 'Open record with entered username rs.Open "select * from userlist where username='"& usr &"'", conn, 3, 3 rs.AddNew rs("username") = usr rs("password") = var rs("fullname") = var2 rs("country") = var3 rs("fld_question") = var4 rs("fld_answer") = var5 rs("fld_email") = var6 rs("fld_visitor_ID") = var7 rs("dd") = day rs("mm") = month rs("yy") = year rs("Status") = status rs("Looking_to") = Looking rs("Gender")=gender rs("Favourite_Quote")= strquote rs("Favourite_Movie")= strfavm rs("Favourite_Bands") = strfavs rs("Sexual_Orientation") = OStats rs("Smoker") = SStats rs("Drinker") = DStats rs("Interests") = strinter rs("About_me") =strdes 'Save record rs.Update set rs=nothing set conn=nothing %>
Hi Thsi is posible only when you PK Field is Identity or some before insert trigger is taking the responsibility of updating the PK filed. Regards :)
Tushar kothari