"ExecuteCommandTextErrorHandling"

  • Thread starter Thread starter vb.net newbie
  • Start date Start date
V

vb.net newbie

Hello Vb.net users

i am having the problem with the below code

Dim selectQuery As String = "Select Price from Items where ItemName = '"
& iname & "' AND size ='" & isize & "'"

If m_ordering.DBConnection.State <> ConnectionState.Open Then
m_ordering.DBConnection.Open()
End If

dim cmd1 As New OleDbCommand(selectQuery, m_ordering.DBConnection)
cmd1.CommandText = selectQuery
Try
cmd1.ExecuteScalar()
Catch ex As Exception
MessageBox.Show(ex.StackTrace)
end try


Thorws me the follwing exception

StackTrace
"
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32
hr)
at
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPA
RAMS dbParams, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object&
executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior
behavior, Object& executeResult)
at
System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior
behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteScalar()
at DBOrder.PizzaOrder.cboSize_LostFocus(Object sender, EventArgs e)
in




I got no idea what is wrong?
Can you please help me.

Thanking you all in advance
 
vb.net newbie said:
Hello Vb.net users

i am having the problem with the below code

Dim selectQuery As String = "Select Price from Items where ItemName
= '" & iname & "' AND size ='" & isize & "'"

If m_ordering.DBConnection.State <> ConnectionState.Open Then
m_ordering.DBConnection.Open()
End If

dim cmd1 As New OleDbCommand(selectQuery, m_ordering.DBConnection)
cmd1.CommandText = selectQuery
Try
cmd1.ExecuteScalar()
Catch ex As Exception
MessageBox.Show(ex.StackTrace)
end try


Thorws me the follwing exception

StackTrace


What does ex.message say? Is there an Innerexcpetion? Examine the ex object
to get more information.


Armin
 
Back
Top