Problem with breakpoints and ADO.NET

G

Guest

I'm having problems using breakpoints with Visual Basic .Net. Breakpoints
work until I excute certain commands. If I set a breakpoint above the
odtrVBDataReader = .ExecuteReader()
statement in the example below it works fine. Any breakpoint after the
statement won't be hit. The code executes as expected, it just won't stop at
the breakpoints. Also if I single-step to the command above, when it is
executed I get the "There is no source code available for the current
location." pop-up. The code below shows an example:

Public Sub Testsub()
Dim Test As String
Dim strVBConn As String = _
"Provider=Microsoft.Jet.OLEDB.4.0;" _
& "User ID=Admin;" _
& "Data Source=""(path)\File"""
Dim ocmdVBCommand As OleDbCommand
Dim odtrVBDataReader As OleDbDataReader
Try
ocmdVBCommand = New OleDbCommand
With ocmdVBCommand
.Connection = New OleDbConnection(strVBConn)
.Connection.Open()
.CommandText = "Select Account, PaidBy From Table"
-> odtrVBDataReader = .ExecuteReader() ' Break points above
this work.
End With
Do While odtrVBDataReader.Read
Test = odtrVBDataReader.GetString(1)
Loop

Catch oexpData As OleDb.OleDbException

Exit Sub
End Try
odtrVBDataReader.Close()
ocmdVBCommand.Connection.Close()
End Sub

Any help would be appreciated.
Thanks,
Rick
 
G

Guest

I have worked around this problem. The statements below do cause the
problem, it's just where it shows up. I eliminated statements until I found
the problem. It was caused by the following statement:
intCharCountE = InStr(intCharCountS, strtest, "~", CompareMethod.Text)
When I removed the CompareMethod.Text option of the statement, the problem
went away.

Rick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top