vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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? thanks |
| ||||
| 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/pro...ads/books.mspx Books Online for SQL Server 2000 at http://www.microsoft.com/sql/prodinf...ons/books.mspx |