Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. is there any way i can update only some fields in the database excluding primary key ? please help

is there any way i can update only some fields in the database excluding primary key ? please help

Scheduled Pinned Locked Moved Web Development
databasehelpsysadmindata-structuresquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bobolov
    wrote on last edited by
    #1

    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 %>

    T 1 Reply Last reply
    0
    • B bobolov

      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 %>

      T Offline
      T Offline
      Tushar Kothari
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups