"ExecuteCommandTextErrorHandling"

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
 
A

Armin Zingler

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
 

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