VB .net, Access Error - specific cast not valid

A

amit

Hi guys

I am trying to use Access Database with VB .net.
In the stock database I have Fields Code and DrugName; Data Type of
both is Text.

In the following code line marked with *** gives the error "specific
cast not valid "

The type of both code and drugname is same so logically it should not
give any error.

Plz help me...


ocmEmpresas.CommandType = CommandType.Text
ocmEmpresas.CommandText = "Select Code,DrugName from Stock"
Dim dr As OleDbDataReader
dr = ocmEmpresas.ExecuteReader()
While (dr.Read() = True)
ListBox1.Items.Add(dr.GetString(0))
****ListBox2.Items.Add(dr.GetString(1))****
End While



Thanks & Regards
Amit
 
P

Peter Proost

Maybe an NULL value in one of the values you want to add

hope this helps,

Greetz, Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top