Hi MrDeveloper,
This question seems to be very similar to previous one asked by you.... following code will do what you want---
Dim MyConn As New SqlConnection(".....")
MyConn .Open()
Dim lobjDa As New SqlDataAdapter("Select * from myTable", MyConn )
Dim lobjDS As DataSet
Dim lobjRow As DataRow
dim lintId as integer
Dim lobjRow As DataRow
lobjDS=new Dataset()
lobjDa.Fill(lobjDS, "tblTemp")
For Each lobjRow In lobjDS.Tables(0).Rows
If lobjRow.Item("Whatever") = "test" Then
lintId =lobjRow.Item("Id")
MsgBox(lintId)
Exit For
End If
Next
lobjDs= nothing
lobjDa= nothing
Mycon=nothing
Rgds,
Jyoti.
Main Topics
Browse All Topics





by: mb333Posted on 2003-09-14 at 19:47:16ID: 9359810
with a dataset:
......") ).Item("ID ")
.....")
Dim MyConn As OleDbConnection = New OleDbConnection(".........
Dim ds As DataSet = New DataSet()
Dim cmd As OleDbDataAdapter = New OleDbDataAdapter("SELECT * from MyTable where Whatever='test'", MyConn)
cmd.Fill(ds, "FindID")
Dim IdToFind As Integer = ds.Tables("FindID").Rows(0
Response.Write(IdToFind)
or with a DataReader:
Dim MyConn As OleDbConnection = New OleDbConnection(".........
Dim MyCommand As OleDbCommand = New OleDbCommand("SELECT * from MyTable where Whatever='test'", MyConn)
Dim MyDataReader As OleDbDataReader
MyConn.Open()
MyDataReader = MyCommand.ExecuteReader()
While MyDataReader.Read
Dim IdToFind As Integer = MyDataReader.Item("ID")
End While
MyDataReader.Close()
MyConn.Close()
Response.Write(IdToFind)