GilbertLiddell
Member
- Joined
- May 4, 2007
- Messages
- 8
- Programming Experience
- Beginner
Hi,
I have used the datareader countless times for returning data yet it's now giving me issues.
The app hangs on the dr.close()
What the hell am I doing wrong here??
Cheers in advance, G
I have used the datareader countless times for returning data yet it's now giving me issues.
VB.NET:
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] strSQL [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] myConnection [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] SqlClient.SqlConnection("server=192.168.1.10;uid=sa;pwd=;database=ebiz2000Q")[/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] myCommand [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] SqlClient.SqlCommand[/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] dr [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] SqlClient.SqlDataReader[/SIZE]
[SIZE=2]strSQL = "Select * from v_ebiz_queue"[/SIZE]
[SIZE=2]myCommand = [/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] SqlClient.SqlCommand(strSQL, myConnection)[/SIZE]
[SIZE=2]myConnection.Open()[/SIZE]
[SIZE=2]dr = myCommand.ExecuteReader(CommandBehavior.CloseConnection)[/SIZE]
[SIZE=2]dr.Read()[/SIZE]
[SIZE=2][COLOR=#008000]'do stuff[/COLOR][/SIZE]
[SIZE=2]dr.Close()[/SIZE]
[SIZE=2]myConnection.Close()[/SIZE]
The app hangs on the dr.close()
What the hell am I doing wrong here??
Cheers in advance, G