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. General Programming
  3. Visual Basic
  4. Primary Key checking

Primary Key checking

Scheduled Pinned Locked Moved Visual Basic
csharphelpdatabasevisual-studioannouncement
3 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.
  • R Offline
    R Offline
    rrrriiizz
    wrote on last edited by
    #1

    Hello All, I want to check a simple think in the database ie i want to check the particular data is already in the database or not. Particular table contain only one field and that field is only a primary key. i want to check it with my frond end that is visual studio.net 2008 I write the below code for that rs.Open("select * from CategoryMaster where categoryname = '"&txtcat.Text &"'", con, CursorTypeEnum.adOpenDynamic, LockTypeEnum.adLockOptimistic) If rs.EOF Then rs.AddNew() rs.Fields("CategoryName") = txtcat.Text rs.Update() txtcat.Text = "" txtcat.Focus() Else MsgBox("This category is Already in database ") End If I that code it shown some error in the below line rs.Fields("CategoryName") = txtcat.Text The error is Property 'Item' is 'ReadOnly' Please help me to resolve this :(( Thanks

    M 1 Reply Last reply
    0
    • R rrrriiizz

      Hello All, I want to check a simple think in the database ie i want to check the particular data is already in the database or not. Particular table contain only one field and that field is only a primary key. i want to check it with my frond end that is visual studio.net 2008 I write the below code for that rs.Open("select * from CategoryMaster where categoryname = '"&txtcat.Text &"'", con, CursorTypeEnum.adOpenDynamic, LockTypeEnum.adLockOptimistic) If rs.EOF Then rs.AddNew() rs.Fields("CategoryName") = txtcat.Text rs.Update() txtcat.Text = "" txtcat.Focus() Else MsgBox("This category is Already in database ") End If I that code it shown some error in the below line rs.Fields("CategoryName") = txtcat.Text The error is Property 'Item' is 'ReadOnly' Please help me to resolve this :(( Thanks

      M Offline
      M Offline
      Marek Grzenkowicz
      wrote on last edited by
      #2

      Try: rs.Fields("CategoryName")**.Value** = txtcat.Text.

      R 1 Reply Last reply
      0
      • M Marek Grzenkowicz

        Try: rs.Fields("CategoryName")**.Value** = txtcat.Text.

        R Offline
        R Offline
        rrrriiizz
        wrote on last edited by
        #3

        Absoulutely. thankyou so much.

        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