Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27512

VS 2010 How to allow duplicate entries in mysql database using vb.net

$
0
0
Hello experts,

I have a table named "products" which has two columns named 'product_name' and 'quantity' ....
So i need an INSERT query to insert entry into this table without duplicate error...


I mean:
Code for inserting a data into table :
Code:

ds = New DataSet
da = New MySqlDataAdapter("INSERT INTO products (product_name, quantity) VALUES('" & tbxProdname.Text & "', '" & Val(tbxQuantity.Text) & "')", conn)
da.Fill(ds, "products")

So..lets think i have inserted one product to the table :

product_name ------------- quantity
Hair Color --------------------- 100 piece

So now i want another product with the same name..and yes i want exactly that same entries in same table....
And i stuck that it occurs an error called "found duplicate productname"

i can IGNORE this error by querying like :
Code:

"INSERT IGNORE INTO products (product_name, quantity) VALUES('" & tbxProdname.Text & "', '" & Val(tbxQuantity.Text) & "')
But by this query i can solve that error but it will not insert the same item in the table....

SO please help me how to allow duplicate entries into a table...

Thanks in advance....

Viewing all articles
Browse latest Browse all 27512

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>