[2005] Display record from Table
Hello! I wonder what's the equivalent value of this vb6 code in vb.net. I would like to display specific valueto textbox from table.
Code:
rsStocks.Open "SELECT * FROM tblStocks WHERE Code = '" & txtCode.Text & "'", oConn, adOpenStatic, adLockOptimistic
If rsStocks.RecordCount <> 0 Then
txtSupply.Text = rsStocks.Fields("Quantity")
txtDesc.Text = rsStocks.Fields("ProductDescription")
'txtSellingPrice.Text = Format$(rsStocks.Fields("SellingPrice"), "P###,###,##0.00") End If
Re: [2005] Display record from Table
You can still use the Format function in VB.NET but you shouldn't. You should use the String.Format method, which I just demonstrated in one of your other threads. That said, Format, String.Format, StringBuilder.AppendFormat and every other method that accepts format strings accepts exactly the same format strings. MSDN has all the details on standard and custom format strings for numerical values as well as dates and times.
Re: [2005] Display record from Table
You'll find a good sample in one of jmc's signature links - http://www.vbforums.com/showthread.php?t=469872
Re: [2005] Display record from Table
i think i was not clear enough when I said I want to display specific value in my first post and for that Im sorry.
What I should have said should be how do i achieved this kind of coding in .net
Code:
txtSupply.Text = rsStocks.Fields("Quantity")
Here i am assigning whatever record the field Quantity to txtSupply.