Reply to Re: How to loop through this sql table and display in ms access listbox

Your name:

Reply:


Posted by Erland Sommarskog on 11/09/06 22:48

Ron (pts4560@yahoo.com) writes:
> I have a table in SQL, that I know how to connect to using ADO, but I
> need help on how to read records from that table.
>
> So on a form I have a listbox where I want to populate that and i have
> a textbox with a userid.
>
>
> Here is an example of the table:
> USER ID TYPE PAYMENT
>=====================
> 0001 CARD 150.00
> 0001 CASH 250.00
> 0002 CASH 175.00
>
>
> If I have 0001 in the txtuserid textbox, I then want to display in
> the listbox:
> CARD 150.00
> CASH 250.00
>
> How would I do this?

Set cmd = CreateObject("ADODB.Command")
Set cmd.ActiveConnection = cnn
cmd.CommandType = adCmdText
cmd.CommandText = "SELECT TYPE, PAYMENT FROM tbl WHERE USER_ID = ?"
cmd.Parameters.Append CreateParameter("@userid", adInteger. _
adParamInput, , txtuserid.text)
rs = cmd.Execute


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация