Datareader equivalent...


Author
Message
StarkMike
StarkMike
Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)
Group: Forum Members
Posts: 436, Visits: 944
Here is some of my code using a datareader... what is the strataframe equivalent to a datareader?





Using conn As New SqlConnection(ConnectionString)

Dim cmd As New SqlCommand



cmd.CommandText = StoredProcedureName

cmd.CommandType = CommandType.StoredProcedure

cmd.Connection = conn



cmd.Parameters.AddRange(params)

conn.Open()



Dim reader As SqlDataReader = cmd.ExecuteReader()



While reader.Read

msLocationName = reader("LocationName")

miLocationID = reader("LocationID")



End While



reader.Close()

reader = Nothing

conn.Close()

End Using





Thanks
Replies
StarkMike
StarkMike
Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)
Group: Forum Members
Posts: 436, Visits: 944
Hey Ben,



Based on the code you provided in your last post I put this piece of code together



 Dim dtbl As DataTable = DataBasics.DataSources("").GetDataTable(cmd, Nothing) 




Which works and does what i want it to... the only question I have is what am i supposed to provide for the ByVal CallBack As System.Data.SqlClient.OnChangeEventHandler argument? I put Nothing and it works I'm just not sure if thats what I'm supposed to put there. Hehe
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Nothing will work fine if you do not want to execute this asynchronously and invoke a callback method when it is completed.  By providing the nothing it will just block until the method has completed executing.
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
That method will always block... the callback is used for you to provide a method that should be called if you are using Query Notification Services and the server raises the DataChanged event.  If you're not using QNS (which you probably aren't) then just pass in Nothing every time.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search