VB SQL Help


B

Brett Baisley

Its been a while since I used VB and I'm new to VB.net. I set up an
sqlConnection, sqlCommand and sqlDataAdapter (by dragging the controls to
the form) to query a local database. I set up a text box to display the
length of the sqldataadapter by doing this:
sqldataadapter.defaultsourcetablename.length and it returns 5 (which is
correct, there should be 5 records in there).

The query should return the ArtistName and AlbumName fields.

What I can't figure out is how to add each record to a listbox? I know its
listbox1.items.add(...) but what do I call? I want to store ArtistName in
one list box and AlbumName in the other.

Can someone finish this off for me? Thanks!

Brett
 
Ad

Advertisements

C

Cor

Hi Brett,

Did you configure the dataadapter and make afterwards a dataset?

You do that by rigthclicking on the dataadapter icoon that is situated below
in your form.

It sounds not, because I hear you not talking about the dataset and that is
used in the way you are using to get the information.
I set up an sqlConnection, sqlCommand and sqlDataAdapter (by dragging the
controls >to the form) to query a local database. I set up a text box to
display the
length of the sqldataadapter by doing this:
sqldataadapter.defaultsourcetablename.length and it returns 5 (which is
correct, there should be 5 records in there).
I hope this helps you a little bit.

Cor
 
B

Brett Baisley

No, I don't have a dataset. I'll look into that and if I still have
problems, I'll get back to you. Thanks!
 
B

Brett Baisley

I got it working with SQLDataReader. It seems to do what I need so far.
 
Ad

Advertisements

C

Cor

Very good Brett,

But it is a totaly different approach, there are so many ways you can do
things with VB.net

Cor
 
Ad

Advertisements


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