January 11, 2010 at 12:33 am
Hi everyone, I normally use VB6 as my programming language to read and write to a SQL server (2000), I've recently gone over to VB.Net (2008), my problem is I can't use NextRecordset anymore, I'm not even sure if this is the right forum, but as I can't seem to get the answer anywhere else I thought I'd give it a try, can anyone please help?
January 11, 2010 at 7:11 am
mick burden (1/11/2010)
Hi everyone, I normally use VB6 as my programming language to read and write to a SQL server (2000), I've recently gone over to VB.Net (2008), my problem is I can't use NextRecordset anymore, I'm not even sure if this is the right forum, but as I can't seem to get the answer anywhere else I thought I'd give it a try, can anyone please help?
I've done some VB.NET stuff, and I don't ever remember using NextRecordset. I'd venture a guess that it's been depreciated, but I could be wrong.
+--------------------------------------------------------------------------------------+
Check out my blog at https://pianorayk.wordpress.com/
January 11, 2010 at 7:48 am
I've been able to find the answer thanks to a work collegue. you use NextResult instead, I've posted a working example of the vb code below
Public function test() As String
test = ""
Dim sqlCnn As SqlConnection
Dim sqlCmd As SqlCommand
Dim sql As String
sql = "sptest"
sqlCnn = New SqlConnection(ResourceConn)
Try
sqlCnn.Open()
sqlCmd = New SqlCommand(sql, sqlCnn)
sqlCmd.CommandType = CommandType.StoredProcedure
Dim sqlReader As SqlDataReader = sqlCmd.ExecuteReader()
While sqlReader.Read()
test = Trim(UCase(sqlReader.Item(0)))
End While
sqlReader.NextResult()
While sqlReader.Read()
test = Trim(UCase(sqlReader.Item(0)))
End While
sqlReader.Close()
sqlCmd.Dispose()
sqlCnn.Close()
Catch ex As Exception
MsgBox(Err.Number & " - " & Err.Description)
End Try
End Function
January 11, 2010 at 9:15 am
Ah, yes. NextResult does sound familiar. Glad you got it working!
+--------------------------------------------------------------------------------------+
Check out my blog at https://pianorayk.wordpress.com/
January 12, 2010 at 5:23 am
VB.net takes things to a whole new level. I'm a VB.net developer as well as the DBA and I never write that sort of code any more. So much is automated for you in the .net objects and their events and properties that my lookup table maintenance programs need two lines of code - to refresh the list after an edit.
Datasource objects are the future with dataviews linked to them to display the data. I use a data access layer with datasets and datatables with stored procedures for all operations then object datasources to link the dataviews and detail views to the datasets. If I use direct code access it's via the dataset and that automatically takes care of a lot.
The best articles I've found on vb.net are on http://www.4guysfromrolla.com especially those by Scott Mitchell and his data access series for Microsoft and all the other tutorials at http://www.asp.net/learn/
January 12, 2010 at 6:40 am
thanks for the info, much appreciated
January 12, 2010 at 7:55 am
P Jones (1/12/2010)
The best articles I've found on vb.net are on http://www.4guysfromrolla.com especially those by Scott Mitchell and his data access series for Microsoft and all the other tutorials at http://www.asp.net/learn/
Seconded! 4GuysFromRolla is probably one of my favorite sites, although I've been frequenting SSC more lately, now that I'm working more of a database role.
+--------------------------------------------------------------------------------------+
Check out my blog at https://pianorayk.wordpress.com/
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply