|
-
Oct 14th, 2004, 08:24 PM
#1
Thread Starter
New Member
loopinh
hello
can anyone help me how to loop? this is the code
dim itemcode as char
Dim conbackview As New OdbcCommand("select item_code from warehouse_mst where jpn =' " & qjpn2 & " ' ", connbackview)
Dim drbackview As OdbcDataReader = conbackview.ExecuteReader(CommandBehavior.Default)
Do While drbackview.Read
itemcode = drbackview.Item("item_code")
MsgBox(itemcode)
Loop
'the connbackview is my connection with my database but it will not disply the itemcode..
hope u can help me
-
Oct 14th, 2004, 08:36 PM
#2
no need to put do
while drbackview.Read
'do your stuff
end while
-
Oct 14th, 2004, 08:40 PM
#3
Frenzied Member
VB Code:
Dim Conn As OleDbConnection
Dim Cmd As OleDbCommand
Dim reader As OleDbReader
Dim itemCode As String
Conn = New OleDbConnection("Your database ConnectionString")
Cmd = New OleDbCommand("SELECT item_code FROM warehouse_mst WHERE jpn ='" & qjpn2 & "'", Conn)
Try
Conn.Open()
reader = Cmd.ExecuteScalar()
If reader.HasRows()
itemcode = reader("item_code").ToString()
End If
MsgBox(itemcode)
reader.Close()
Catch ex As Exception
MsgBox(ex.Message())
Finally
Conn.Close()
End Try
Last edited by Memnoch1207; Oct 15th, 2004 at 05:52 PM.
Being educated does not make you intelligent.
Need a weekend getaway??? Come Visit
-
Oct 14th, 2004, 08:58 PM
#4
Thread Starter
New Member
loss
helo
id try it but i did not work..
im using odbc driver
-
Oct 14th, 2004, 09:06 PM
#5
Thread Starter
New Member
loss
helo
id try it but i did not work..
im using odbc driver
-
Oct 14th, 2004, 09:11 PM
#6
Thread Starter
New Member
table format :
item_code jpn
000001 2222
000002 2222
then i want to get the item_code if the txtjpn s equal to the jpn from the table
how should i do that?
thanks
-
Oct 15th, 2004, 11:13 AM
#7
Frenzied Member
Why don't you just use OLEDB, it's faster?
Being educated does not make you intelligent.
Need a weekend getaway??? Come Visit
-
Oct 15th, 2004, 11:16 AM
#8
if you are using a datareader you need to call the read method to get the first record
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|