Ronsky Pis-an Ronsky Pis-an - 4 months ago 13
SQL Question

How to check if record is existing in ms access database using vb.net?

I have to publish vacant positions in publication system. But before saving in database it will check the Position title in "Postit" column/field and item number in "itemno" column/field if the text already existing in record in the same row. I dont know if it is correct to put many "WHERE" inside the .Open clause or can I put "AND" to avoid many "WHERE". Can you please help me solve this. Thanks... Some part of the codes is stated below:

Error in this line of code:

.Open("Select * from pop where vacantnotvacant ='" & "vacant" & "' , where Position = '" & ListViewEx1.Items.Item(h).SubItems(2).Text & "'", psipopcon, 2, 3)

Answer

Try this in place of your open line

.Open("Select * from pop where vacantnotvacant ='" & "vacant" & "' and Position = '" & ListViewEx1.Items.Item(h).SubItems(2).Text & "'", psipopcon, 2, 3)
Comments