I am using the code below (one of way too many samples) trying to accept strings from form and pass them to ODBC connect query. No matter which way I twist it, I always get a Format exception error.
I can not get the input string to accept the three parameters in the correct format.
Any ideas?
Private Sub btn_search_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_search.Click
Dim p_tax_year As Integer = Convert.ToInt32(cbx_tax_year.SelectedText)
Dim p_taxpayer_doc_num As Integer = Convert.ToInt32(tb_taxpayer_document_nm.Text)
Dim p_taxpayer_ssn As Integer = Convert.ToInt32(tbx_taxpayer_ssn.Text)
Dim OdbcDataAdapter_all_forms_list As DataSet_all_forms_list
OdbcConnection2.Open()
Add Parameters and set values
listSelectCmd.Parameters.Clear()
listSelectCmd.Parameters.Add(p_tax_year)
listSelectCmd.Parameters.Add(p_taxpayer_doc_num)
listSelectCmd.Parameters.Add(p_taxpayer_ssn)
Dim DataSet_all_forms_list1 As DataSet = New DataSet
Dim TAXPAYER As DataTable = DataSet_all_forms_list1.Tables("TAXPAYER")
Try
listSelectCmd.ExecuteNonQuery()
Catch SqlExceptionErr As SyntaxErrorException
MessageBox.Show(SqlExceptionErr.Message)
End Try
OdbcConnection2.Close()
End Sub
I can not get the input string to accept the three parameters in the correct format.
Any ideas?
Private Sub btn_search_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_search.Click
Dim p_tax_year As Integer = Convert.ToInt32(cbx_tax_year.SelectedText)
Dim p_taxpayer_doc_num As Integer = Convert.ToInt32(tb_taxpayer_document_nm.Text)
Dim p_taxpayer_ssn As Integer = Convert.ToInt32(tbx_taxpayer_ssn.Text)
Dim OdbcDataAdapter_all_forms_list As DataSet_all_forms_list
OdbcConnection2.Open()
Add Parameters and set values
listSelectCmd.Parameters.Clear()
listSelectCmd.Parameters.Add(p_tax_year)
listSelectCmd.Parameters.Add(p_taxpayer_doc_num)
listSelectCmd.Parameters.Add(p_taxpayer_ssn)
Dim DataSet_all_forms_list1 As DataSet = New DataSet
Dim TAXPAYER As DataTable = DataSet_all_forms_list1.Tables("TAXPAYER")
Try
listSelectCmd.ExecuteNonQuery()
Catch SqlExceptionErr As SyntaxErrorException
MessageBox.Show(SqlExceptionErr.Message)
End Try
OdbcConnection2.Close()
End Sub