i am using vb2010 express. can u pls tell me wat is the code for delete?bcoz when im doing delete my database is not updating after i exit.i can add item in database but i cant delete it.any help?thanx guys? hope u understand my problem.

Recommended Answers

All 3 Replies

I'm not clear on whether your problem is with VB or SQL so I'll just give you the syntax for a SQL delete.

DELETE FROM tablename 
 WHERE condition

Let's say you have a table named Accounts and you want to delete the account for the person whose last name is "Flintstone" and first name is "Fred" (even though it's more likely you would delete by account number in case you have two people with the same name)

DELETE FROM Accounts
 WHERE LastName  = 'Flintstone'
   AND FirstName = 'Fred'

here is a screen shot.for example i want to delete the entire row.thanx for the help.

Same format with different column names. I don't know which column, or combination of columns you would need to narrow the delete down to just one record. Apparently your database does not have a primary key. I base this on the observation that you have a record with no values, and a primary key must have a value. Assuming IQAMA contains a unique value you would do

DELETE FROM yourtablename
 WHERE IQAMA = 1231231232

if IQAMA is a numeric field or

DELETE FROM yourtablename
 WHERE IQAMA = '1231231232'

is a string. Just replace yourtablename with the actual name of the table.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.