I was wondering if anyone knew how to code to read a record from an inventory database? I think you need to use a while loop.

while read rcd1 rcd2 rcd3
do

that's all I got so far. I am really getting upset about this pesudocode thing. I don't understand this at all.

Recommended Answers

All 2 Replies

Most times we use recordset objects to read from datasources. We do this by:

1. Instantiating the connection
2. Instantiating the recordset object
3. Determining what data we want returned
4. Executing the command.
5. Working with the records.

Here is a brief example of working with the records:

RECORDSET.MoveFirst 'Moves to first record in the set
DO WHILE RECORDSET.EOF = FALSE
<insert code to work with the record>
RECORDSET.MoveNext ' Advances to the next record in the set
LOOP

I was wondering if anyone knew how to code to read a record from an inventory database? I think you need to use a while loop.

while read rcd1 rcd2 rcd3
do

that's all I got so far. I am really getting upset about this pesudocode thing. I don't understand this at all.

do u want to read single record based on conditions means u can use like

Dim connString As String = "server=siraj; database=programmersheaven;" + _
                                   "uid=sa; pwd="
Dim conn As New SqlConnection(connString)
conn.Open()

Dim cmdString As String = "select * from author"
Dim cmd As New SqlCommand(cmdString, conn)

Dim reader As SqlDataReader = cmd.ExecuteReader()

While reader.Read()
            txtData.Text += reader("authorId").ToString()
            txtData.Text += ", "
            txtData.Text += reader("name").ToString()
            txtData.Text += vbCrLf
        End While
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.